Rather than remember the name of the form bean, I use the following:

<c:set scope="page" var="formBean"
value="${sessionScope[requestScope['org.apache.struts.action.mapping.instanc
e'].name]}"/>

Note that I uses session scoped form beans - the expression would have to
change slightly for request scoped ones.

Paul

> -----Original Message-----
> From: Robert Taylor [mailto:[EMAIL PROTECTED]
> Sent: 14 August 2005 19:18
> To: Struts Users Mailing List
> Subject: Re: Using JSTL to access form bean properties
> 
> 
> Your form bean should be in either request or session scope under the 
> name used to define it in struts-config.xml file. What I 
> usually do is 
> something like the following:
> 
> <c:set var="form" value="${myform}"/>
> 
> 
> and then you can use it like any other object with c:if or c:choose.
> 
> <c:choose>
> <c:when test="${form.someBooleanProperty}">
> 
> </c:when>
> <c:otherwise>
> 
> </c:otherwise>
> </c:choose>
> 
> 
> Even though the form bean is already defined in some scope, I 
> redefine 
> it at the top of the page to avoid having to make multiple reference 
> changes if my form name happens to change. If it does, I only 
> change it 
> in one place.
> 
> /robert
> 
> Néstor Boscán wrote:
> > Hi
> > 
> > Has anybody used JSTL to access form bean properties. I'm 
> using JSTL and
> > Struts Tags and I would like to do some conditioning using 
> <c:if> and
> > <c:choose> using the form bean properties.
> > 
> > Regards,
> > 
> > Néstor Boscán
> > 
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > 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]
> 

Axios Email Confidentiality Footer
Privileged/Confidential Information may be contained in this message. If you 
are not the addressee indicated in this message (or responsible for delivery of 
the message to such person), you may not copy or deliver this message to 
anyone. In such case, you should destroy this message, and notify us 
immediately. If you or your employer does not consent to Internet email 
messages of this kind, please advise us immediately. Opinions, conclusions and 
other information expressed in this message are not given or endorsed by my 
Company or employer unless otherwise indicated by an authorised representative 
independent of this message.
 
WARNING:
While Axios Systems Ltd takes steps to prevent computer viruses from being 
transmitted via electronic mail attachments we cannot guarantee that 
attachments do not contain computer virus code.  You are therefore strongly 
advised to undertake anti virus checks prior to accessing the attachment to 
this electronic mail.  Axios Systems Ltd grants no warranties regarding 
performance use or quality of any attachment and undertakes no liability for 
loss or damage howsoever caused.


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

Reply via email to