Never mind... that didn't fix it either.  property is a property of target,
which is another object.

Carl

Quoting [EMAIL PROTECTED]:

> Kris,
> 
> Thanks for your tip.  You lead me to the answer.  Here is what works:
> 
> <c:set var="person" value="${requestScope.personForm}"/>
> <c:set var="nestedProp" value="name.firstName"/>
> <c:set var="val" value="${nestedProp}" property="${person}" />
> 
> Now, we can all stand around and scratch our heads and say "Duh! Why didn't
> I
> think of that?"  Setting the person as the property tells JSTL to use
> person
> as a bean and allows it to do normal nested queries on nestedProp.  Oh man
> do
> I feel like a dummy.
> 
> Carl
> 
> Quoting Kris Schneider <[EMAIL PROTECTED]>:
> 
> > Then I don't see how to make it work with JSTL. So, "nestedProp" is a
> > scoped
> > variable containing the nested property you want to access, right? Does
> > this
> > work for you:
> > 
> > <jsp:useBean id="nestedProp" type="java.lang.String"/>
> > <bean:write name="personForm" property="<%= nestedProp %>"/>
> > 
> > Unfortunately, I don't think Struts-EL provides a version of
> <bean:write>
> > or you
> > could also try:
> > 
> > <bean-el:write name="personForm" property="${nestedProp}"/>
> > 
> > Quoting [EMAIL PROTECTED]:
> > 
> > > 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/>
> > 
> > -- 
> > 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]
> 
> 




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

Reply via email to