`
yizhilong28
  • 浏览: 229360 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
社区版块
存档分类
最新评论

strut2.0.14

阅读更多
最进有点时间,学习下struts2,版本是2.0.14
参照这位老兄的博客http://www.blogjava.net/max/category/16130.html,学习
遇到
According to TLD or attribute directive in tag file, attribute value does not accept any expressions

查看半天,原来是从2.0.11版本器,struts不再支持struts标签、jetl混用了

设置includ页面参数只能使用
<s:param name="ParamName">ParamNameValue</s:param>
includ页面获取参数,只能使用${param.ParamName}
参见:http://struts.apache.org/2.0.14/docs/include.html

struts2 could not be resolved as a collection/array/map/enumeration/iterator type

直接访问jsp页面时,容易出面上面情况,原因是action没有初始化。
通过action来访问jsp
http://localhost:8080/struts2/example/UITagExample.action

Could not create and/or set value back on to object
struts 表单使用POJO访问时,容易遇到上述错误
form片段如下
<s:form action="LoginX" method="POST">
    <s:textfield name="user.name" label="User name"/>
    <s:password name="user.password" label="Password"/>
    <s:submit value="Submit"/>
</s:form>

action片段
private User user;

原因是user在action中还没有初始化,
解决:
1、在user类中添加无参数的构造方法,public User() {}
2、在action类中,初始化user private User user = new User("","");









分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics