开发者

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.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜