日期:2014-05-18  浏览次数:20687 次

struts2.0!如何在action中设置前台jsp中form元素的默认值!!!
在struts1中,,可以在Actionfrom中设置默认值
前台会有效,
但struts2.0中没有ActionForm中,应该怎么设置
才能在访问jsp前得到actionfrom中getter的值

------解决方案--------------------
你是不是没有学过struts2呀
PO
public class Dept{
 String deptid; 
 String deptname;
public Dept(){
 }
getter,setter 
}
public class deptAction extends ActionSupport{
 Dept dept;//PO
setter ,getter
 public String dept(){
return SUCCESS;
}
}
你在页面直接可以用${dept.deptid},${dept.deptname}
去看我的资源,有很多struts2.x hibernate3.x spring2.x的项目,相信对你有用