当前位置: 代码迷 >> Java Web开发 >> struts2.0!怎么在action中设置前台jsp中form元素的默认值!
  详细解决方案

struts2.0!怎么在action中设置前台jsp中form元素的默认值!

热度:48   发布时间:2016-04-17 12:20:29.0
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的项目,相信对你有用
  相关解决方案