如何从action传递参数到struts配置文件

时间:2021-10-12 11:23:31
首先,Action中必须有那个Filed,以及get方法 

然后,在配置文件中用ONGL表达式,${属性名}的方式,配置result:
 

Action中:  
Java代码  如何从action传递参数到struts配置文件
  1. //需要传递的参数
  2. private String preURL;  
  3.   
  4. public String getPreURL() {  
  5.         return preURL;  
  6. }  
  7.   
  8. //.................  



XML中的配置:
 
Xml代码  如何从action传递参数到struts配置文件
  1. <action name="logout" class="edu.xjtu.jxg.struts.action.LogoutAction">  
  2.     <result type="redirect">${preURL}</result>  
  3. </action>