Struts2几种传值

时间:2023-04-19 08:16:20

1.url向action传值

url为

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

action中取值为

import org.apache.struts2.ServletActionContext;

String teacher_seq = ServletActionContext.getRequest().getParameter("teacher_seq"); 

2.JSP

session.setAttribute("user",user); 

3..java

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