Struts2几种传值

 1.url向action传值

url为

  
  
  
  
  1. http://localhost/txyl/teacher_info?method:teacher_info&teacher_seq=dedafdsf322124few 

action中取值为

  
  
  
  
  1. import org.apache.struts2.ServletActionContext;
  2.  
  3. String teacher_seq = ServletActionContext.getRequest().getParameter("teacher_seq"); 

 

2.JSP

  
  
  
  
  1. session.setAttribute("user",user); 

3..java

  
  
  
  
  1. ActionContext.getContext().getSession().put("chapter_id",chapter_id);  

 

你可能感兴趣的:(struts2)