1,ActionForm中setter和getter的类型必须对应
2, 在ActionForm中many to one的one方可这样设置
public String getParentid() {
return son.getParent().getParentid().toString();
}
public void setParentid(String parentid) {
if (parentid!= null && !"".equals(parentid)) {
son.setParent(new Parent(new Long(parentid)));
}
}
3,contextRelative
如果该值被设置为 true,那么路径就被认为是相对于整个 Web 应用的相对路径。
如果该值被设置为 false,那么路径就被认为是相对于一个模块化应用程序的这个模块的相对路径。默认为false。
4,<bean:write>输入网页时必须加filter=false
2, 在ActionForm中many to one的one方可这样设置
public String getParentid() {
return son.getParent().getParentid().toString();
}
public void setParentid(String parentid) {
if (parentid!= null && !"".equals(parentid)) {
son.setParent(new Parent(new Long(parentid)));
}
}
3,contextRelative
如果该值被设置为 true,那么路径就被认为是相对于整个 Web 应用的相对路径。
如果该值被设置为 false,那么路径就被认为是相对于一个模块化应用程序的这个模块的相对路径。默认为false。
4,<bean:write>输入网页时必须加filter=false
本文介绍在Struts框架中使用ActionForm的最佳实践,包括setter和getter类型的正确配置、many-to-one关联设置方法及路径配置技巧。
337

被折叠的 条评论
为什么被折叠?



