This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes Problem with fields not being remembered after refresh Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem with fields not being remembered after refresh" Watch "Problem with fields not being remembered after refresh" New topic
Author

Problem with fields not being remembered after refresh

Eric Juneau
Greenhorn

Joined: Jul 13, 2009
Posts: 28
Okay, I'm in struts 2.0 and appcelerator.

I have a form where there are some search criteria fields (field set A), a data table, and "submit button" that calls Method A in the action. Below that some more fields (field set B) and an "add item" button which acts like another submit button that calls Method B in the same action.

When you click "add item" button, it calls Method B and saves the data from field set B. Then the form refreshes, but any of the data you filled out in field set A is forgotten. I know its in the Action when Method B is called. It displays field set A if an error occurs when calling Method B, but not if it completes successfully. I want the form to remember the data that was entered in field set A when Method B completes succcessfully. It appears to be totally refreshing the form as a redirect-action, which is good, because the data table is supposed to show the newly added item. I've tried hidden fields on the jsp but these don't seem to work.

Let me know if you have any questions or need clarification on anything.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60752
    
  65

Please be sure to ask Struts questions in the Struts forum. I have moved this post there for you.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I need clarification: actions are created per-request; if you redirect you're getting a new action instance.
Eric Juneau
Greenhorn

Joined: Jul 13, 2009
Posts: 28
I found a different framework for achieving what I needed to accomplish using Ajax.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with fields not being remembered after refresh
 
Similar Threads
same jsp page for add and edit
Hard days with a rich:tabPanel inside a h:form
Confirm message on submit
struts 2 validation problem
Cant store data in database table Hibernat/Spring/JSF