Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1107151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:53:52+00:00 2026-05-17T01:53:52+00:00

Using Spring 3 I have two forms: adding Item and invalidating Item I have

  • 0

Using Spring 3

I have two forms: adding Item and invalidating Item
I have ItemAddEditCommand that references Item and some other data.

Adding Item works great but I have problem with invalidating Item. In general it is an edit form that contains two form fields – expirationDate and comment.

In the controller I’m using the same command for both actions. Unfortunately Spring attempts to bind all fields when I invalidate. When starting to invalidate I populate ItemCommand with Item instance that has all possible fields filled (including id)

When user inserts expireDate and comment and submits the form then all other fields except expiresDate and comment are nulled.

Is there another way except creating another command

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T01:53:53+00:00Added an answer on May 17, 2026 at 1:53 am

    I think I found it.

    @InitBinder(value = { INVALIDATE_ITEM_PARAM })
    protected void initInvalidateItemBinder(WebDataBinder binder) {
      DefaultBindInitializer.initBinder(binder);
      binder.setAllowedFields("expireDate", "comment");
      binder.setValidator(validator);
    } 
    

    Btw. Maybe anyone can give me pointers how to get rid of DefaultBindInitializer.initBinder(binder); that initializes some property editors that should be ALWAYS used. Maybe some bean to make it default so I wouldn’t have to call this method all the time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two forms using a ListView component. In the first form it works
I'm using Struts2. I have two web forms that have the same code. I
I'm using NHibernate 2.1.2 and Spring 1.3 I have two Text columns (blobs) in
I have configured in following way that spring MVC app using Spring 3.1.1.RELEASE web.xml
I'm using spring ws 2.0.2.RELEASE I have a web service that creates a sales
I am preparing a registration page using JSF/Spring webflow&mvc application. I have added two
There are two forms of the QObject::tr() function I have been using for translating
I have a data entity that I use in two ways, I populate a
I have two forms a) post.php b) edit.php I am using the checkbox in
I'm trying to make Login feature by using TCP Client. I have two forms:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.