• Post Reply Bookmark Topic Watch Topic
  • New Topic

Passig values to and from JSPs to Actions without losing original values

Kevin P Smith
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I have an object called 'TestObject' with parameters


If I'm editing the values of TestObject taken from a database and I have parameters
name, email & telNo displayed on the screen, but dateCreated is not displayed

When I click 'save' values name, email & telNo of object testObject will be passed back to my Action from my JSP, dateCreated will now be
NULL as the value was never sent to the JSP in the first place.

Is there a way in which you should handle this properly in Struts2 to retain the original value from the database, or do you have to have a hidden
field on your JSP carrying the value of dateCreated?
I ask, because potentially you could have dozens of fields which you do not want on the screen, especially if only certain values are
editable on certain screens and it seems overkill to have to have them all as hidden fields.

Hope this makes sense!

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!