Problem: "[action]" does not accept any expressions
I tried to use the following code :
<li>
<% for (int i=0; i<parentList.size(); i++) {
Role p = parentList.get(i);
%>
<li><a href="<s:url action="<%=p.getFunclink() %>"/>"><%=p.getFuncname() %></a>
<ul>
<% for (int j=0; j<roleList.size(); j++) {
Role c = roleList.get(j);
if (!c.getFuncid().equalsIgnoreCase(c.getParentfunc()) && c.getParentfunc().equalsIgnoreCase(p.getFuncid()))
{
%>
<li><a href="<s:url action="<%=c.getFunclink() %>"/>"><%=c.getFuncname() %></a>
<%
}
}
%>
</ul>
<% } %>
</li>
but it throw error:
JSPG0227E: Exception caught while translating /menu.jsp:
/menu.jsp(95,17) --> JSPG0124E: Ac开发者_StackOverflowcording to TLD or attribute directive in tag file, attribute "[action]" does not accept any expressions. Value of expression is: "[%=p.getFunclink() %]".
How can i fix it? Thanks!
The Struts tags cannot accept expressions, thus:
<s:url action="<%=p.getFunclink() %>"/>
is invalid.
- First, avoid using scriptlets at all.
- Second, look into using the
<s:iterator/>
tag to iterate over your collections.
精彩评论