Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java Open Source > Struts
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Struts section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 4th, 2006, 12:19 AM
Registered User
Join Date: Jun 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to chamalsl
Default Controlling reset method of form bean


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,

Old July 12th, 2006, 05:37 AM
Registered User
Join Date: Jul 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts

 setting "scope=session" in view account details action tag (struts-config.xml) may resolves u r problem.

Old August 8th, 2006, 12:06 AM
Authorized User
Join Date: Aug 2006
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to sachin.tathod

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,
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to reset the form? vinaykurudi Apache Tomcat 0 September 29th, 2008 05:26 AM
Form Bean in Struts meetravig Struts 0 July 19th, 2007 01:01 AM
Notice: Undefined variable: comments/ Form reset dungey Pro PHP 10 December 1st, 2006 04:00 AM
how 2 reset a form kanoorani Javascript How-To 6 October 10th, 2005 05:45 AM
C# reset of checkbox after form submission booksnore2 General .NET 5 July 29th, 2004 10:30 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.