我有2个action,第一个action把值传到第二个action跳转到第二个action
请各位高手指教啊,能解决问题的有追加悬赏的
第一个action,searchAction.java,有2个查询方法,根据ID和NAME查询,然后将查询结果保存到list里面,把这个list传到第二个action里面并跳转到第二个action
public class searchAction extends Action{
ArrayList list=new ArrayList();
public ActionForward searchByID(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)throws Exception {
list = .........//查询方法
return mapping.findForward("IDsuccess");//这里应该怎么写呀
}
public ActionForward searchByName(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)throws Exception {
list = .........//查询方法
return mapping.findForward("NAMEsuccess");//这里应该怎么写呀
}
}
第二个action,ShowAction.java,将第一个action传过来的list显示到页面上
public class searchAction extends Action{
ArrayList list=new ArrayList();
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)throws Exception {
list=.................//这里代码不知道怎么写,就是要获得第一个action里面传过来的list
return mapping.findForward("success");
}
}