Struts升级到2.5.5(从2.5.3) [英] Struts Upgrade to 2.5.5 ( from 2.5.3)
问题描述
我试图从Struts 2版本2.5.3
升级到2.5.5
...我遇到了一个奇怪的问题.
I tried to upgrade from struts 2 version 2.5.3
to 2.5.5
... I face an strange issue.
我们有一个如下标签:
<%@tag description="Rensders an ajax link" pageEncoding="UTF-8"%>
<%@attribute name="parameters" description="list of parameters that put to this link"
type="java.util.HashMap" required="false"%>
..............
<c:forEach items="${parameters}" var="p">
<c:param name="${p.key}" value="${p.value}"/>
</c:forEach>
当我升级时,上面的代码会引发异常!
The above code throws exception when I upgrade !
Caused by: javax.servlet.jsp.JspTagException: Don't know how to iterate over supplied "items" in <forEach>
at org.apache.taglibs.standard.tag.common.core.ForEachSupport.toForEachIterator(ForEachSupport.java:274)
at org.apache.taglibs.standard.tag.common.core.ForEachSupport.supportedTypeForEachIterator(ForEachSupport.java:238)
at org.apache.taglibs.standard.tag.common.core.ForEachSupport.prepare(ForEachSupport.java:155)
at javax.servlet.jsp.jstl.core.LoopTagSupport.doStartTag(LoopTagSupport.java:256)
at org.apache.jsp.tag.web.html.link_tag._jspx_meth_c_005fforEach_005f0(link_tag.java:439)
at org.apache.jsp.tag.web.html.link_tag._jspx_meth_c_005furl_005f0(link_tag.java:405)
at org.apache.jsp.tag.web.html.link_tag._jspx_meth_sec_005fauthorize_005f0(link_tag.java:366)
at org.apache.jsp.tag.web.html.link_tag.doTag(link_tag.java:230)
如您所见,该标记是JSTL标记而不是struts!
As you see the tag is a JSTL tag not struts !
我使用Tomcat 8.0. 有任何评论.
I use Tomcat 8.0 . Any comments.
推荐答案
令人惊讶的是,我在标签中使用的parameters
名称与struts 2冲突.上下文,这导致名称冲突.
Surprisingly the parameters
name which I used in my tag has a conflict with struts 2. It seems that this version of struts has defined a parameters
in the context, which made a name conflict.
当我在jsp struts 2.5.3
中测试${parameters}
时,我注意到
When I test ${parameters}
in a jsp struts 2.5.3
I see noting
当我在jsp struts 2.5.5
中测试${parameters}
时,我看到了org.apache.struts2.dispatcher.HttpParameters
When I test ${parameters}
in a jsp struts 2.5.5
I see org.apache.struts2.dispatcher.HttpParameters
所以我将may tag属性重命名为params
,一切都很好!
So I renamed may tag attribute to params
and everything is fine!
这篇关于Struts升级到2.5.5(从2.5.3)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!