Hi,

Thanx again for your answer :)

The problem is that I don't want to nest my ActionForm, I want them all 
treated as a unique session bean. Without them being into (dependant of) 
another ActionForm.

>so you can retrieve them from other Actions/JSPs by
>using request.getAttribute( <ActionForm logical name> ).

I suppose you meant request.getSession().getAttribute( <ActionForm logical 
name> ), didn't you ? :)

Friendly Regards,
Slimane

At 15:12 15/03/2002 -0800, Someone poor demented soul by the name of 
"Joseph Barefoot" presented us with the following text which may contain 
useless information.
>Valid questions, all. :)  I have to admit I'm not 100% sure when the
>ActionForm bean is first instantiated/initialized, but this is what I think:
>The ActionForm bean is created and initialized when the URI specified by the
>action-mapping for this particular Action/ActionForm pair is requested.
>(if this is incorrect, please someone correct me)
>
>If you want to share beans, just declare the scope to be "session" for the
>bean in question in the action-mapping for this action inside
>struts-config.xml.  Struts stores these beans as attributes in the
>HTTPSession object, so you can retrieve them from other Actions/JSPs by
>using request.getAttribute( <ActionForm logical name> ).
>
>As for the last question, ActionForm beans can appear as fields inside other
>ActionForms, so you can nest your form beans such that when one gets
>instantiated, all of the nested form fields get instantiated too.  Then you
>can reference them as nested attributes of the parent ActionForm inside any
>of your Struts JSP tags.  You can also retrieve them from the session in a
>similar manner:
>
>request.getAttribute( <ActionForm logical name> ).getMyNestedForm()
>
>happy coding,
>
>Joe
>
>-----Original Message-----
>From: Slimane [mailto:[EMAIL PROTECTED]]
>Sent: Friday, March 15, 2002 1:58 PM
>To: Struts Users Mailing List
>Subject: RE: problem with bean having session scope
>
>
>Hi,
>
>Thanks for your answer, I'll try to remove the <jsp:useBean> tag.
>
>But I still do have a question :) You say that:
> >Struts takes care of instantiating,
> >read/writes, and scope management for these beans
>
>well, then when does he do that ? The first time I call the Action Class ?
>If so, what if I want to share 3 beans ? The first time I'll call one
>Action Class, only one ActionForm will be instanciated, no ?
>
>Friendly Regards,
>Slimane
>
>At 10:03 15/03/2002 -0800, Someone poor demented soul by the name of
>"Joseph Barefoot" presented us with the following text which may contain
>useless information.
> > > > I suppose the form bean is created the first time I use a jsp:useBean
> >tag
> > > > in my jsp file, isn't it ?
> > > >
> > > > (for example: <jsp:useBean id="searchbydateform" scope="session"
> > > > class="be.stluc.info.struts.SearchByDateForm"/>)
> >
> >Actually, the creation of the ActionForm bean is handled by the Struts
> >framework itself (I guess by the controller servlet?).  That's how forms
>can
> >be populated "automatically" via the Struts taglibs and then passed to the
> >Action class associated with this particular ActionForm class.
> >
> >This is just a shot in the dark...but perhaps the explicit creation you are
> >specifying by the <jsp:useBean> tag is screwing up Strut's management of
>the
> >ActionForm bean?  In any case, you don't need to use the <jsp:useBean> tag
> >at all for ActionForm beans, as Struts takes care of instantiating,
> >read/writes, and scope management for these beans.
> >
> >
> >--joe
> >
> >-----Original Message-----
> >From: Slimane Zouggari [mailto:[EMAIL PROTECTED]]
> >Sent: Friday, March 15, 2002 9:15 AM
> >To: Struts Users Mailing List
> >Subject: Re: problem with bean having session scope
> >
> >
> >Thanx, I supposed it was something like that :)
> >The thing is, I still don't understand why my beans aren't shared among all
> >of my action classes :(
> >
> >Friendly Regards,
> >Slimane
> >
> >At 12:05 15/03/2002 -0500, you wrote:
> > >AFAIK, a session bean is destroyed when the session expires (30 min by
> > >default).
> > >
> > >Otavio
> > >
> > >----- Original Message -----
> > >From: "Slimane Zouggari" <[EMAIL PROTECTED]>
> > >To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > >Sent: Friday, March 15, 2002 12:02 PM
> > >Subject: Re: problem with bean having session scope
> > >
> > >
> > > > well as nobody seems to have a clue about my problem. I'll ask my
> >question
> > > > differently :)
> > > >
> > > > When is a session bean destroyed ?
> > > > If I specify, a form bean to have a session scope (as I did in the
> > > > struts-config.xml), when will it be destroyed ?
> > > >
> > > > I suppose the form bean is created the first time I use a jsp:useBean
> >tag
> > > > in my jsp file, isn't it ?
> > > >
> > > > (for example: <jsp:useBean id="searchbydateform" scope="session"
> > > > class="be.stluc.info.struts.SearchByDateForm"/>)
> > > >
> > > > Finally, what could be the reasons, that some of my Action classes see
> > >(can
> > > > use their values) some session beans, while others don't ?
> > > >
> > > > Thanx for having taken the time to read me :)
> > > >
> > > > Friendly Regards,
> > > > Slimane
> > > >
> > > > At 12:11 15/03/2002 +0100, you wrote:
> > > > >Hi,
> > > > >
> > > > >I have 3 form beans. Each of them have a session scope defined in the
> > > > >struts-config.xml.
> > > > >
> > > > >Here's the config for one of them:
> > > > >>     <action path="/piechart"
> > > > >>             type="be.stluc.info.struts.PieChartAction"
> > > > >>             name="piechartform"
> > > > >>             scope="session">
> > > > >
> > > > >When I try to access them in one of my Action class, I don't have any
> > >problem.
> > > > >But when I try to access them, from one other Action class, then
> > >suddenly,
> > > > >they don't exist anymore.
> > > > >
> > > > >I used the piece of code, Mr Keith Bacon posted in reply of one of my
> > > > >previous mail (
> > > >
> > >
> >
> >http://www.mail-archive.com/struts-user@jakarta.apache.org/msg25984.html )
> > > > >
> > > > >And that so, I saw that one time, my session contains all three form
> > >beans
> > > > >and another time my session contains only one form bean.
> > > > >
> > > > >Here's the code I use in my Action classes:
> > > > >
> > > > >>         ParticipantDetailsForm partDetForm =
> > > > >>               (ParticipantDetailsForm)
> > > > >> request.getSession().getAttribute("participantdetailsform");
> > > > >
> > > > >(participantdetailsform is one of the 3 form beans I share in the
> > >session)
> > > > >
> > > > >Could anyone give me pointers where I should look for ? Because, I'm
> >sure
> > > > >it's a stupid mistake but I can't find it :(
> > > > >
> > > > >Thanx in advance.
> > > > >
> > > > >Friendly Regards,
> > > > >Slimane
> > > > >
> > > > >
> > > > >--
> > > > >To unsubscribe, e-mail:
> > ><mailto:[EMAIL PROTECTED]>
> > > > >For additional commands, e-mail:
> > ><mailto:[EMAIL PROTECTED]>
> > > >
> > > >
> > > > --
> > > > To unsubscribe, e-mail:
> > ><mailto:[EMAIL PROTECTED]>
> > > > For additional commands, e-mail:
> > ><mailto:[EMAIL PROTECTED]>
> > > >
> > >
> > >
> > >--
> > >To unsubscribe, e-mail:
> ><mailto:[EMAIL PROTECTED]>
> > >For additional commands, e-mail:
> ><mailto:[EMAIL PROTECTED]>
> >
> >
> >--
> >To unsubscribe, e-mail:
> ><mailto:[EMAIL PROTECTED]>
> >For additional commands, e-mail:
> ><mailto:[EMAIL PROTECTED]>
> >
> >
> >--
> >To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
> >For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>
>
>
>--
>Make it run, Make it right, Make it fast
>
>
>--
>To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>
>
>
>--
>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


--
Make it run, Make it right, Make it fast


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to