日期:2014-05-18  浏览次数:20787 次

求struts中怎样将一个action转发到另一个action的具体方法,急~~~~~~~~~~~~~~~~
内容如题,会的请告知~~~~~

------解决方案--------------------
<forward ............>
------解决方案--------------------
<forward name= "aaa " path= "/xxx.do " />
------解决方案--------------------
你直接在一个action中调用另一个action的方法,不行么?
------解决方案--------------------
public class ClassA extends DispatchAction {
public ActionForward methodA(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
return ClassB.methodB(mapping, form, request, response);
}
}
这样不知道行不,具体没试过。
------解决方案--------------------
应该不可以
------解决方案--------------------
在第一个的action的path设置成第二个action的path.do
------解决方案--------------------
用forward应该可以的
------解决方案--------------------
就是forward
------解决方案--------------------
采用public forward,
return mapping。findForward( "public forward 1 ");
------解决方案--------------------
直接return method(mapping , form , request , response);应该就可以了

------解决方案--------------------
response.sendRedirect(request.getContextPath()+ "/action.do?method=index ");
------解决方案--------------------
你是在用eclipse+struts就相当简单了,跳转,页面是怎么转的,.do的也是那么转,可以 的
------解决方案--------------------
ACTION跳转到ACTION(一):
String str = "XXX.do?action=xxx ";
response.sendRedirect(str);

ACTION跳转到ACTION(二):
RequestDispatcher ds = request.getRequestDispatcher( "xxx.do?action=xxx ");
ds.forward(request, response);
------解决方案--------------------
<forward name= "xxx " path= "xxx.do "/>
------解决方案--------------------
你一个action做不完么,还要两个Action