this should work:

<c:set var="person" value="${requestScope.personForm}"/>
<c:set var="_name" value="name"/>
<c:set var="_firstName" value="firstName"/>
<c:out value="${person[_name][_firstName]}"/>


From: [EMAIL PROTECTED]
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: Struts Users Mailing List <[EMAIL PROTECTED]>
Subject: Re: JSTL evaluate problems
Date: Fri, 17 Oct 2003 12:29:44 -0500

No. The variable that is actually nestedProp is populated dynamically. Most
of the time it is just a single property name, but from time to time, it needs
to be nested.


Carl

Quoting Kris Schneider <[EMAIL PROTECTED]>:

> Are you just trying to shorthand this:
>
> <c:out value="${person.name.firstName}"/>
>
> In other words, person.getName().getFirstName().
>
> Quoting [EMAIL PROTECTED]:
>
> > JSTL is not nesting appropriately.  Here is an example of what I am
> doing:
> >
> > <c:set var="person" value="${requestScope.personForm}"/>
> > <c:set var="nestedProp" value="name.firstName"/>
> > <c:out value="${person[nestedProp]}"/>
> >
> > The error that I am getting is:
> > Unable to find a value for "name.firstName" in object of class
> > "org.team.Person" using operator "[]" (null)
> >
> > If nestedProp was just firstName (and Person had a firstName property)
> then
> > this works just fine.  JSTL is not seeing the . and doing
> > getName().getFirstName()
> >
> > I have tried a number of combinations with [] and ' (escape) and \ and
> ....
> > nothing works :(  Any help appreciated.
> >
> >
> > Carl
>
> --
> Kris Schneider <mailto:[EMAIL PROTECTED]>
> D.O.Tech       <http://www.dotech.com/>
>
> ---------------------------------------------------------------------
> 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]


_________________________________________________________________
Never get a busy signal because you are always connected with high-speed Internet access. Click here to comparison-shop providers. https://broadband.msn.com



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



Reply via email to