wood burning stoves 2.0*
The moose likes Struts and the fly likes Handling data carry between different pages - Design handliing. 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 "Handling data carry between different pages - Design handliing." Watch "Handling data carry between different pages - Design handliing." New topic
Author

Handling data carry between different pages - Design handliing.

Bharat Chowdary
Greenhorn

Joined: Feb 13, 2011
Posts: 7
I'm having 3 jsp pages which are having similar fields (like text field 'My name' is present on all the 3 pages) & different fields too(I'm having text field 'company name' present on page 2 only). I'm trying to use single actionForm but the problem is i dont want data filled for 'My Name' field on page 1 to be displayed directly in the text field of page 2.

How to handle this ?

I'm using single actionForm so that the getter & setter methods will not be redundant.

Design is like this:

ActionForm same for all the 3 pages.
1 Action class(controller), 1 bean class(model), 1 DAO class for db queries for each Jsp page(view).

Idea, of any better handling of actionForm is very much welcome.
Bharat Chowdary
Greenhorn

Joined: Feb 13, 2011
Posts: 7
bluzeee blu wrote:I'm having 3 jsp pages which are having similar fields (like text field 'My name' is present on all the 3 pages) & different fields too(I'm having text field 'company name' present on page 2 only). I'm trying to use single actionForm but the problem is i dont want data filled for 'My Name' field on page 1 to be displayed directly in the text field of page 2.

How to handle this ?

I'm using single actionForm so that the getter & setter methods will not be redundant.

Design is like this:

ActionForm same for all the 3 pages.
1 Action class(controller), 1 bean class(model), 1 DAO class for db queries for each Jsp page(view).

Idea, of any better handling of actionForm is very much welcome.

No one has replied yet...any reason ?? Please let me know if you didn't understand what i asked here. I have to complete the design. So please some help needed.
Tom Rispoli
Ranch Hand

Joined: Aug 29, 2008
Posts: 349
Assuming you want to clean out all the fields and assuming you have code to do this in the reset() method in your bean then you can call the reset method before you run your .jsp. If the list of fields you want to clean out depends on what .jsp you are going to then you can make methods to clean out those specific fields depending on what .jsp you are going to.
Bharat Chowdary
Greenhorn

Joined: Feb 13, 2011
Posts: 7
Tom Rispoli wrote:Assuming you want to clean out all the fields and assuming you have code to do this in the reset() method in your bean then you can call the reset method before you run your .jsp. If the list of fields you want to clean out depends on what .jsp you are going to then you can make methods to clean out those specific fields depending on what .jsp you are going to.


Thanks for replying....

The problem is ...wen moving form a page to next , forward is written in this way..

<forward name="success" path="/ThankYou.jsp" /> it directly points to jsp ...Is that fine design ? So the flow doesn't go to action class/bean class, so thre is no way to reset the values.

I also tried...

<forward name="success" path="/ThankYou.jsp" redirect=”true” /> But in this case..i'm loosing all the data...i need the data filled on page 1 but shouldn't get displayed directly on the page 2.

Hmmmm.....Lot to Learn...!!

n Thanks for the help.

Tom Rispoli
Ranch Hand

Joined: Aug 29, 2008
Posts: 349
Your first forward looks fine. You just need to do the resetting in your action before you return the forward that sends the user to the thankyou.jsp.
Bharat Chowdary
Greenhorn

Joined: Feb 13, 2011
Posts: 7
Tom Rispoli wrote:Your first forward looks fine. You just need to do the resetting in your action before you return the forward that sends the user to the thankyou.jsp.


Okayy..So here is wat i understood....

So let me say,

Request comes to AActionClass.java[supportive ABeanClass.java]-->AView.jsp--Onuser action 1-->AActionClass.java[ABeanClass.java][Reset form values here; Forward=nextView.jsp on success]->nextView.jsp--onUser action 2-->BAction.java[BBeanClass.java]---------->>>>>

Thanks for your help Tom Rispoli]!!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Handling data carry between different pages - Design handliing.
 
Similar Threads
One form bean having form split into two different jsp pages
Dynamically pass values from one jsp to another
Carrying large VO down to ActionForm
[SPRING] Java Bean doesn't get prepared
Where to keep “form” value