[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Struts related question
Put your FormBean in session scope using :
<action path="/A"
type="com.AAction"
name="taxBean"
scope="session"
validate="false"
input="/a.jsp">
<forward name="failure"
path="/error.do"/>
<forward name="success"
path="/b.jsp"/>
</action>
<action path="/B"
type="com.BAction"
name="taxBean"
scope="session"
validate="false"
input="/b.jsp">
<forward name="failure"
path="/error.do"/>
<forward name="success"
path="/c.jsp"/>
</action>
By putting the FormBean into session scope, you can
re-use the bean instance. It would be a good idea to
remove it from the sessin once it is no longer needed
(i.e. in com.DAction (assuming you use A, B, C and
D)).
Hope this helps -
--- KUMARAN MANI <kumaranm@yahoo.com> wrote:
> 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!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/