哪位大虾帮帮忙,JSP往domain model传值,急急急!!!

baiyunlqy8 2010-05-07 08:59:54
主要部分代码
//jsp
<td width="40%">
<s:textfield name="user.UserID" id="user.userID" maxlength="12"></s:textfield>
</td>
//User.java
public class User {
private String userID;
public String getUserID() {
return userID;
}
public void setUserID(String userID) {
this.userID = userID;
}
}
//UserRegisterAction .java
public class UserRegisterAction extends ActionSupport {
public User user;
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
@Override
public String execute() throws Exception {
System.out.println("===================================");
return SUCCESS;
}
}
//UserRegisterAction-validation.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
<validators>
<field name="user.userID">
<field-validator type="requiredstring">
<param name="trim">true</param>
<message key="error.userID.required"></message>
</field-validator>
<field-validator type="stringlength">
<param name="minLength">6</param>
<param name="maxLength">12</param>
<message key="error.userID.length"></message>
</field-validator>
</field>
</validators>

没有异常抛出,就是接收不到JSP传进来的值.用属性就可以接.但是浪曦教程上就是这么写的.是不是还有什么地方和属性传值不一样啊!!!调试一天了都..
...全文
28 点赞 收藏 回复
写回复
回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2010-05-07 08:59
社区公告
暂无公告