struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wendy Smoak" <wsm...@gmail.com>
Subject Re: Struts-EL and Struts features not in JSTL and EL
Date Mon, 28 Aug 2006 15:00:53 GMT
On 8/28/06, Mead, Robert F (Titan) @ TITAN <robert.mead@l-3com.com> wrote:

> <logic:equal value="someValue" name="${param.formName}" property="someProp">
>
> The Struts libraries are intelligent enough to take a dynamic form name and find the
property.
>
> I have not been able to get the same behavior to work using JSTL and EL.
> For example the following fails (and I've tried a bunch of other guesses to no avail):
> <c:if test="${param.formName.someProp}"> gives "unable to find value for someProp
in object String"
>
> Is there a way to get the same functionality without using the Struts tags?

The first issue I see is that you need to find the form itself, using
'param.formName' as the key into the session or request map.  I think
you're going to have to know where the form is stored for this to
work.

Then you need to get the property out of the form.  You said it's a
dynamic form, so you'll need to go through the form's 'map' property
to do that.

Try something like this:

  <c: if test="${session[param.formName].map.someProp}" >

You may want to split it up with a <c:set>, to make it more readable.

Now someone will probably point out that I'm making it far more
complicated than it needs to be. :)

-- 
Wendy

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


Mime
View raw message