Here's something that does (almost) work:
<s:param name="mEntry" value="#attr.list.getEntry(#attr.row,0)"/>
The problem is that access to JSP locals simply does not work. As a
workaround, i must use the page context, like so here:
Further up in the JSP:
<%
pageContext.setAttribute("list", list);
%>
And inside the for loop:
<%
pageContext.setAttribute("row", row);
%>
With this, the value is constructed dynamically as i want it, i.e. the
ognl expression #attr.list.getEntry(#attr.row,0) translates to a method
call list.getEntry(row, 0).
Robert
Robert Graf-Waczenski wrote:
Hm. Tried this, didn't work. Let me be more verbose now:
The class MyList wraps data in a backend and offers it to the view in
list form, for this, the class has methods like so here:
public int getRowCount();
public String getEntry(int row, int col);
Here's the JSP (which has been redirected to, so the ValueStack is
empty, i guess):
<%
MyList list = (MyList) session.getAttribute(MyList.SESSION_KEY);
int row = 0;
for (; row < list.getRowCount(); row++) {
%>
<tr class="<%=row % 2 == 0 ? "normalcell" : "emphasizedcell"%>">
<td></td>
<td nowrap valign="top">
<a href="<s:url namespace=""
action="delete.action"><s:param
name="mEntry"/></s:url><%=list.getEntry(row,0)%>">
<%=list.getEntry(row, 0)%>
</a>
</td>
</tr>
<%
}
%>
This correctly yields hrefs which dynamically end in "mEntry=" plus
the value returned by getEntry().
Now let's try the same with ognl. From what you write, i should be
able to use this syntax here:
<s:param name="mEntry" value="#attr.list.entry(#attr.row,0)"/>
I tried this, the urls now have no parameters at all, so something
must have went wrong when the ognl expression was evaluated. Any
further pointers? BTW, i did read the ognl documentation and i am
under the assumption to have understood it :-)
Robert
Dave Newton wrote:
--- On Wed, 12/17/08, Robert Graf-Waczenski wrote:
[...] how would i access the value of a JSP-local variable in an
ognl expression?
#attr.foo
http://struts.apache.org/2.x/docs/ognl.html
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org