You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Néstor Boscán <ne...@tcs.com.ve> on 2005/08/14 18:40:34 UTC

Using JSTL to access form bean properties

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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Using JSTL to access form bean properties

Posted by Néstor Boscán <ne...@tcs.com.ve>.
Thanks Robert 

-----Mensaje original-----
De: Robert Taylor [mailto:64rwtaylor05@bellsouth.net] 
Enviado el: Sunday, August 14, 2005 2:18 PM
Para: Struts Users Mailing List
Asunto: 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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Using JSTL to access form bean properties

Posted by Robert Taylor <64...@bellsouth.net>.
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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org