Struts already does this, it stores the form under the name you specified in
your action mapping. So if you have:

 <action path="/myActionPath" name="myFom" ...

Then struts stores the form under "myForm" in whatever scope you specify
(request or session).

Niall


----- Original Message ----- 
From: "Lukas Hazlehurst" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Thursday, April 22, 2004 2:26 AM
Subject: RE: Getting the form bean on a page for use in a core tag


> Bill,
>
> Thanks for your help here. We actually ended up working down a different
> path for this particular issue but I am now using this technique in
> other code.
>
> One thing we did to make the core tag code more generic was to store a
> reference to the form bean in the request attributes under a short,
> constant value ('formBean'). This way our el can look like
> ${formBean.map.txtFullLegalName}, much like the way the html tags pick
> up the form bean by default. We were able to do this (setting the form
> bean) consistently because we are running thru a little process type
> action which is subclassed for each process.
>
> Lukas
>
> -----Original Message-----
> From: news [mailto:[EMAIL PROTECTED] On Behalf Of Bill Siggelkow
> Sent: Wednesday, 21 April 2004 1:53 p.m.
> To: [EMAIL PROTECTED]
> Subject: Re: Getting the form bean on a page for use in a core tag
>
>
> Ahh! Bach!  The wrinkle here is the DynaValidatorForm and not a regular
> ActionForm ...
>
> Try this ...
>
> <core:if test="${studentDetailsBasicForm.map.age > 20}">
>   <p>do something</p>
> </core:if>
>
> For complete details ...
>
> http://jakarta.apache.org/struts/api/org/apache/struts/action/DynaAction
> Form.html#getMap()
>
> Bill Siggelkow
>
> Lukas wrote:
>
> > Daniel,
> >
> > What i'm trying to achieve is to use the <core:if> tag to
> > conditionally show some content based on a value of the form bean.
> >
> > Something along the lines..
> >
> > <core:if test="${studentDetailsBasicForm.age > 20}">
> > <p>do something</p>
> > </core:if>
> >
> > where 'studentDetailsBasicForm' is the name of my form for the action
> > of which this jsp page is a view (a forward) and age is a property of
> > that form. In this case the form is a DynaValidatorActionForm.
> >
> > I'm not in the office at the moment so the code is just from memory,
> > but it gives you the idea.
> >
> > I guess i could use the bean:define to copy out each attribute of the
> > bean, but it doesn't seem very tidy.
> >
> > Lukas
> >
> >
> >>-----Original Message-----
> >>From: Daniel Henrique Alves Lima [mailto:[EMAIL PROTECTED]
> >>Sent: Tuesday, 20 April 2004 10:52 p.m.
> >>To: Struts Users Mailing List
> >>Subject: Re: Getting the form bean on a page for use in a core tag
> >>
> >>    Lukas, i don't know if i understand your question, but: Can you
> >>use <bean:define> to "access and rename" your bean so you can use it
> >>in a el expression ?
> >>
> >>Lukas Hazlehurst wrote:
> >>
> >>
> >>>Hello,
> >>>
> >>>I apologise if I've missed something obvious somewhere, but
> >>
> >>I'm trying
> >>
> >>>to use a property of my form bean in a core tag, and I'm
> >>
> >>just missing
> >>
> >>>how to refer to the form bean easily, since the constant
> >>
> >>name has full
> >>
> >>>stops in it which I presume will muck up the el expression.
> >>>
> >>>I've been looking thru my list archives and I can't seem to find any
> >>>reference to the problem which probably means I'm missing the point
> >>>somewhere, but any help would be appreciated.
> >>>
> >>>Lukas
> >>>
> >>>
> >>>---------------------------------------------------------------------
> >>>To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>>For additional commands, e-mail: [EMAIL PROTECTED]
> >>>
> >>>
> >>>
> >>
> >>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >>---
> >>Incoming mail is certified Virus Free.
> >>Checked by AVG anti-virus system (http://www.grisoft.com).
> >>Version: 6.0.659 / Virus Database: 423 - Release Date: 15/04/2004
> >>
> >>
> >
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.659 / Virus Database: 423 - Release Date: 15/04/2004
> >
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.659 / Virus Database: 423 - Release Date: 15/04/2004
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>



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

Reply via email to