[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Struts related question

I was just reading Strut docs and the answer seems to me is  NO.

The controller servlet will first check if there is session scope bean
available. If no, it creates a new one and add to the session. If yes, it
uses the existing one. So A, B, C, D will access the same bean as long as
they belong to the same session.

Hope it helps.


----- Original Message -----
From: "KUMARAN MANI" <kumaranm@yahoo.com>
To: <ajug-members@ajug.org>
Sent: Thursday, March 21, 2002 9:41 AM
Subject: RE: Struts related question

> How y'all doing,
> I need some suggestions/help.
> I have a form, which expands to few different pages
> (say four pages). For eg; think of the Tax form. You
> have multiple pages to fill in right..?
> So I am thinking of how to design this with Struts.
> I think, I should have A.jsp, B, C, D.jsp and
> A.Controller, B, C, D and I would want only one
> FormBean (TaxBean).. because all this details are
> finally relavant to one table and I would like to keep
> it all in one bean and on a submit on last page
> (D.JSP), I would want to pass it to the DB layer
> (which knows what to do with this).
> But, in Struts, when we define the Config.XML, with
> the ACTION tag, for each Controller defined , it has
> its own FormBean's instance, Am I right?.
> <form-beans>
>     <!-- Tax bean -->
>     <form-bean      name="taxBean"
>                     type="com.TaxBean"/>
> <action path="/A">
> <type = "com.AController">
> <name = "/taxBean">
> <input = "/A.jsp">
> <forward = "/B.jsp">
> </action>
> <action path="/B">
> <type = "com.BController">
> <name = "/taxBean">
> <input = "/B.jsp">
> <forward = "/C.jsp">
> </action>
> and it goes on..
> Now, for every request call to the servlet A or B ..,
> there will be a new instance of the TaxBean.? Yes/No
> I could probably do this with other alternatives.. but
> what is the Struts way. May be I am missing the basic
> definition of a FormBean. So, team help.
> Thanks. Have a good day.
> Kumaran
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Movies - coverage of the 74th Academy Awards®
> http://movies.yahoo.com/

Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com