为什么要分离哦,分离了那还叫action的属性bean吗?

解决方案 »

  1.   

    LZ的意思是不是写成类似C++中的.h文件和.cpp文件?哈哈
      

  2.   


    public class YourAction{
        private YourBean bean=new YourBean();
        //..getter setter...    //..Some Action Method
    }public class YourBean{
        //..properties
    }<s:text property="bean.propertyName" />
    代码未经测试....
      

  3.   

    你把userName , userPassword等变量封装成一个类,比如User然后再代码里用private User user;这样就实现了属性和方法分离!!
      

  4.   

    这就是所谓的域驱动的struts2 而不是属性驱动
    类似于struts1的 formbean