论坛首页 Java版 Struts

struts2-core-2.0.11与struts2-core-2.0.8兼容问题

浏览 868 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
时间:2008-05-06
struts2-core-2.0.8升级到struts2-core-2.0.11 发现 个 问题 。

原来这样的写法都正常

     <s:if test="${not empty param.kindId}">
     document.getElementById("kindId").value =${param.kindId};
     </s:if>



现在 都抱错 :

javax.servlet.ServletException: org.apache.jasper.JasperException: /module/basic_manage/user_show.jsp(85,5) According to TLD or attribute directive in tag file, attribute test does not accept any expressions


查了它的 tld文件发现,居然 :

一个是 :

    <attribute>
      <name>test</name>
      <required>true</required>
      <rtexprvalue>true</rtexprvalue>
      <description><![CDATA[Expression to determine if body of tag is to be displayed]]></description>
    </attribute>


另一个是 :
    <attribute>
      <name>test</name>
      <required>true</required>
      <rtexprvalue>false</rtexprvalue>
      <description><![CDATA[Expression to determine if body of tag is to be displayed]]></description>
    </attribute>



他们在搞什么啊? 不支持表达式了 。 兼容性啊!
   
时间:2008-05-06
是%不是$
   
请登录后投票
时间:2008-05-07
quaff 写道
是%不是$



我 改成
     <s:if test="%{not empty param.kindId}">
     document.getElementById("kindId").value =${param.kindId};
     </s:if>


之后 虽然不抱错了,但还是if里面的没有执行 。struts2-core-2.0.8那个版本 用 $是正常的。
   
请登录后投票
时间:2008-05-07
请使用ognl表达式.楼主用的明显是el表达式.
用ognl的话,改成
<s:if test="%{param.kindId != null}"> 即可.
   
请登录后投票
时间:2008-05-07
myoldman 写道
请使用ognl表达式.楼主用的明显是el表达式.
用ognl的话,改成
<s:if test="%{param.kindId != null}"> 即可.

btw s:if标记默认就是支持ognl的,所以
<s:if test="param.kindId != null">应该就可以了.
   
请登录后投票
时间:2008-05-08
myoldman 写道
请使用ognl表达式.楼主用的明显是el表达式.
用ognl的话,改成
<s:if test="%{param.kindId != null}"> 即可.



实不相瞒


我改成
 <script type="text/javascript" xml:space="preserve">
     alert("11");
     <s:if test="%{param.kindId != null}">
     alert("22");
    document.getElementById("kindId").value =${param.kindId==null};
     </s:if>
</script>


还是不行 11执行 22不执行 。 地址栏 :http://localhost:81/module/basic_manage/user_show.htm?kindId=8
   
请登录后投票
时间:前天
奇怪了楼主我如下写法都是正常的.
<s:if test="#session['currentLoginUser'] != null" >
<s:url id="successLoginUrl" namespace="/include" action="successLogin"></s:url>
<iframe width="100%" height="280px" frameborder="0" id="loginFrame" src="<s:property value="successLoginUrl"/>"></iframe>
</s:if>

你的kindId是int还是字符串啊?
   
请登录后投票
时间:前天
myoldman 写道
奇怪了楼主我如下写法都是正常的.
<s:if test="#session['currentLoginUser'] != null" >
<s:url id="successLoginUrl" namespace="/include" action="successLogin"></s:url>
<iframe width="100%" height="280px" frameborder="0" id="loginFrame" src="<s:property value="successLoginUrl"/>"></iframe>
</s:if>

你的kindId是int还是字符串啊?



struts小版本是多少 是 11 么?
   
请登录后投票
时间:前天
是的啊.我的版本是struts2-core-2.0.11.1.jar
   
请登录后投票
时间:前天
myoldman 写道
是的啊.我的版本是struts2-core-2.0.11.1.jar


我又换回 08 那个版本了.我怕他了.

希望以后版本能兼容这个 08 版本
   
请登录后投票
论坛首页 Java版 Struts

跳转论坛:
JavaEye推荐
    快速回复 引用上一条消息 (Alt+S)