You could do the following in, say, one of your action classes to remove a
session scoped bean called "foo"

request.getSession().removeAttribute("foo");


----- Original Message -----
From: "Gangadharappa, Kiran" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 29, 2001 5:52 PM
Subject: RE: beans and scope


> if it is session scope, When will the bean get destroyed?
> Does it have to wait till the session is ended?
> What I mean is , isnt there any way to control the lifetime of this bean
say
> programmatically?
>
> -----Original Message-----
> From: Niall Pemberton [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, June 28, 2001 2:35 PM
> To: [EMAIL PROTECTED]
> Subject: RE: beans and scope
>
>
> You can use "request" scope by storing the values in hidden fields using
the
> <html:hidden> tag - that way the values you are not showing get
re-populated
> back into your form when submitted.
>
> Additionally to what John said about the "default" scope - I agree it is
> "session" but Struts also supplies two ActionMapping sub-classes which can
> be used to control the "default" scope - these are SessionActionMapping
and
> RequestActionMapping - all you have to do is add a "mapping" attribute to
> the web.xml and you can have whichever default scope you prefer.
>
>     <init-param>
>       <param-name>mapping</param-name>
>
> <param-value>org.apache.struts.action.RequestActionMapping</param-value>
>     </init-param>
>
> Niall
>
> > -----Original Message-----
> > From: DHarty [mailto:[EMAIL PROTECTED]]
> > Sent: 28 June 2001 21:22
> > To: [EMAIL PROTECTED]
> > Subject: RE: beans and scope
> >
> >
> > Thank you John!
> >
> > Funny thing is, I had changed that in previous attempts.  When that
didn't
> > work, I must have forgot to put it back.
> >
> > Speaking of request scope,  Is there a way to do this (wizard steps)
using
> > the request scope, or do I just have to make the action classes
> > responsible
> > for reseting the form to start from scratch?
> >
> > Thanks again
> >
> > David
> >
> > -----Original Message-----
> > From: John Schroeder [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, June 28, 2001 4:01 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: beans and scope
> >
> >
> > Try removing the scope="request" line below.  The formbean will default
to
> > session scope (I believe).  If you specify request scope, then
> > the formbean
> > will be accessible on the second page, but not the third...
> >
> > This worked for me after I banged my head against it as well!!
> >
> >     <!-- Create Project-->
> >     <action    path="/projectcreate"
> >                type="edu.erau.dcm.teammate.action.ProjectCreateAction"
> >                name="ProjectForm"
> >                scope="request"      <-- remove this.
> >                validate="false"
> >                input="/admin/project/project_create.jsp">
> >       <forward name="next"
> > path="/admin/project/project_add_leader.jsp"/>
> > <forward name="cancel"     path="/admin/project/project_admin.jsp"/>
> >     </action>
> >
> > Hope this helps...
> >
> > --John
> >
> >
> >
> >
> >
> > -----Original Message-----
> > From: DHarty [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, June 28, 2001 12:57 PM
> > To: [EMAIL PROTECTED]
> > Subject: beans and scope
> >
> >
> > I'm trying to get a series of pages to populate a form ala a "wizard"
> > interface.
> >
> > Each page enters a chunck of information which is then forwarded
> > to the next
> > page in the sequence.  The previous information is dispalyed along with
an
> > area to enter the next bit of info.
> >
> > The Problem is that after the information on the second page is
> > entered, the
> > third page doesn't receive the information from the fist page, only the
> > second.  The informatoin never makes it into the second pages
> > action class.
> > I made the scope="session", but this still doesn't work.
> >
> > Please help, I've been banging my head against this for days.
> >
> >
> > ------first page-------------------------------
> > <html:form action="/projectcreate" scope="session">
> >       <p>Enter Project Name: </b> <html:text name="ProjectForm"
> > property="name" tabindex="1" /> </p>
> >       <p>&nbsp;</p>
> >       <p><b>Project Description:</b></p>
> >       <blockquote> <html:textarea cols="50" name="ProjectForm"
> > property="description" rows="5" tabindex="2" />
> >       </blockquote>
> >       <p align="right">
> >   <html:cancel tabindex="4"/>
> > <html:submit tabindex="3">Next</html:submit>
> >       </p>
> > </html:form>
> > ----------------------------------------------
> > -----second page---------------------------------------
> >
> >  <html:form action="/projectaddleader" scope="session">
> > <b>Add Project Leader:</b>
> > <html:text name="ProjectForm" property="newLeader" />
> > <html:submit />
> >
> > Project Name:
> > <bean:write name="ProjectForm" property = "name" />
> >
> > Project Description:
> > <bean:write name="ProjectForm" property = "description"/>
> >   </html:form>
> > ----------------------------------
> > --------from stuts-config.xml-------------------------------
> >     <form-bean      name="ProjectForm"
> >                     type="edu.erau.dcm.teammate.form.ProjectForm"/>
> >
> > ....
> >
> >     <!-- Create Project-->
> >     <action    path="/projectcreate"
> >                type="edu.erau.dcm.teammate.action.ProjectCreateAction"
> >                name="ProjectForm"
> >                scope="request"
> >                validate="false"
> >                input="/admin/project/project_create.jsp">
> >       <forward name="next"
> > path="/admin/project/project_add_leader.jsp"/>
> > <forward name="cancel"     path="/admin/project/project_admin.jsp"/>
> >     </action>
> >
> > <!-- Add Leader to Project -->
> >     <action   path="/projectaddleader"
> >            type="edu.erau.dcm.teammate.action.ProjectCreateAction"
> >            name="ProjectForm"
> >            scope="request"
> >            validate="false"
> >            input="/admin/project/project_add_leader.jsp">
> >     <forward name="next"    path="/admin/project/project_verify.jsp"/>
> >     <forward name="finished"
path="/admin/project/project_admin.jsp"/>
> >     <forward name="cancel"     path="/admin/project/project_admin.jsp"/>
> >     </action>
> >
> > ------------------------------------------
> >
>

Reply via email to