You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Security Management <li...@secmgmt.com> on 2009/04/09 16:54:21 UTC
Help with an Expression in a JSP page.
All,
I have the following:
<s:iterator value="exception.exceptionValues">
<li>
<s:property
value="personProvider.department([0].top)"/>
</li>
<li>
<s:property value="[0].top"/>
</li>
</s:iterator>
The second <li> gives me the correct number, but the first does not. I want
the first to translate to:
getPersonProvider().getDepartment(1)
Which is a valid query in my action. Can someone suggest how to do that, or
point me to some documentation? I've read through the Struts stuff here:
http://struts.apache.org/2.1.6/docs/ognl.html
and here:
http://struts.apache.org/2.1.6/docs/ognl-basics.html
I can't imagine it's not possible to call a function with an argument, but
maybe it is, or maybe it's a bad idea and the controller should handle it...
Ognl.org is down.
Thanks!
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Help with an Expression in a JSP page.
Posted by Dave Newton <ne...@yahoo.com>.
Charlesmel Carino wrote:
> I think that the department object needs to be declared as a bean
> first before you can actually reference it.
Not really; OGNL, like JSTL, allows property access.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Help with an Expression in a JSP page.
Posted by Charlesmel Carino <ch...@yahoo.com>.
I think that the department object needs to be declared as a bean first before you can actually reference it.
Rommel
________________________________
From: Security Management <li...@secmgmt.com>
To: Struts Users Mailing List <us...@struts.apache.org>
Sent: Thursday, April 9, 2009 10:54:21 AM
Subject: Help with an Expression in a JSP page.
All,
I have the following:
<s:iterator value="exception.exceptionValues">
<li>
<s:property
value="personProvider.department([0].top)"/>
</li>
<li>
<s:property value="[0].top"/>
</li>
</s:iterator>
The second <li> gives me the correct number, but the first does not. I want
the first to translate to:
getPersonProvider().getDepartment(1)
Which is a valid query in my action. Can someone suggest how to do that, or
point me to some documentation? I've read through the Struts stuff here:
http://struts.apache.org/2.1.6/docs/ognl.html
and here:
http://struts.apache.org/2.1.6/docs/ognl-basics.html
I can't imagine it's not possible to call a function with an argument, but
maybe it is, or maybe it's a bad idea and the controller should handle it...
Ognl.org is down.
Thanks!
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Help with an Expression in a JSP page.
Posted by Dave Newton <ne...@yahoo.com>.
Security Management wrote:
> <s:iterator value="exception.exceptionValues">
> <li>
> <s:property value="personProvider.department([0].top)"/>
> </li>
> <li>
> <s:property value="[0].top"/>
> </li>
> </s:iterator>
>
> The second <li> gives me the correct number, but the first does not. I want
> the first to translate to:
I'm not sure why you need to use bare stack access to get a value from
an iterator, but try "personProvider.department(%{[0].top})" as a
starter. Personally I think if the value is being iterated over I'd use
something more like:
<s:iterator value="exception.exceptionValues" var="n">
<s:property value="personProvider.department(n)"/>
</s:iterator>
but I don't know what you're actually trying to iterate over.
> I can't imagine it's not possible to call a function with an argument,
Guess you haven't used JSP EL; you're lucky.
> Ognl.org is down.
Use the OpenSymphony OGNL site.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org