|
Subject:
|
Controlling reset method of form bean
|
|
Posted By:
|
chamalsl
|
Post Date:
|
6/4/2006 12:19:19 AM
|
Hi,
As I know the reset method of a form bean is called automatically when a action tries to add the form bean to session or retrieve it.
Is there a way that we can stop the reset method being called.
======================================================================== This is what I am trying to do.
I have two form beans for Customer and Account and two actions to "view account list of customer" and "view account details". First action is linked with Customer bean and it display the list of accounts owned by the customer. The second action is linked with Account bean and it shows the details of account selected by user.
public void Customer extends ActionForm { Vector accounts = new Vector(); //Elements of this vector contains Account beans
//other attributes and methods
}
public void Account extends ActionForm { //attributes and methods
}
For examle let's think there are four Accounts in accounts vector. The first action displays this list on a JSP. User clicks on first account and views details. Then user goes back and clicks on second account. Then the data of first account object is reset and gets lost. This is my problem/
=========================================================================
Thanking You, Chamal.
|
|
Reply By:
|
dp_jakkamsetti@yahoo.com
|
Reply Date:
|
7/12/2006 5:37:04 AM
|
Hi, setting "scope=session" in view account details action tag (struts-config.xml) may resolves u r problem.
|
|
Reply By:
|
sachin.tathod
|
Reply Date:
|
8/8/2006 12:06:16 AM
|
Hi U can sol;ve ur problem in two ways.
1.Eithe ru can pass Account or customer information to the JSP page by using request.setAttribute("Account" account); session.putSessionData("Account" account);
and access ur information from request or session scope
2.U can put the both variables if possible and access it on the same form.
Thanks and Regards, SACHIN S.TATHOD Patni Computer System Ltd. Magarpatta City, Cyber City, Tower 3,Level I & II, Hadapsar,Pune - 411028 Mobile No:- +91-9881239401 Email ID:- sachin.tathod@patni.com
|