File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Passig values to and from JSPs to Actions without losing original values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Passig values to and from JSPs to Actions without losing original values" Watch "Passig values to and from JSPs to Actions without losing original values" New topic
Author

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

Kevin P Smith
Ranch Hand

Joined: Feb 18, 2005
Posts: 362
If I have an object called 'TestObject' with parameters

TestObject.name
TestObject.email
TestObject.telNo
TestObject.dateCreated

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!

:-D
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Passig values to and from JSPs to Actions without losing original values