写一个方法,把path="/jsp2.jsp"/里面内容换成参数不可以吗?

解决方案 »

  1.   

    to: bluepingguo
    那怎么给参数赋值呢?
      

  2.   

    <global-forwards>
        <forward name="play2" path="/jsp2.jsp"/> 
        <forward name="play1" path="/jsp1.jsp"/> 
      </global-forwards>其中Action:
    package wjhstruts;
    import org.apache.struts.action.*;
    import javax.servlet.http.*;public class wjhAction extends Action {
      public ActionForward perform(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
        wjhActionForm wjhActionForm = (wjhActionForm) actionForm;
    if(request.getParameter("a1")!=null&&"打开页面1".equals((String)request.getParameter("a1"))) {
        return (actionMapping.findForward("play1"));
    }
    if(request.getParameter("a2")!=null&&"打开页面2".equals((String)request.getParameter("a2"))) {
       return (actionMapping.findForward("play2"));
      }
    }
      

  3.   

    jFresH_MaN(The answer is ......)(静下心来研究Tiger) 大哥:
    request.getParameter("a1")!=null&&"打开页面1".equals((String)request.getParameter("a1"))) 是什么意思,运行错误哦!请指正。
      

  4.   

    用submit提交一个.do处理两个页面跳转很麻烦,不如用button:
      

  5.   

    to:jFresH_MaN(The answer is ......)(静下心来研究Tiger)大哥:
      在下面中:
      if(request.getParameter("a1")!=null&&"打开页面1".equals((String)request.getParameter("a1"))) {
        return (actionMapping.findForward("play1"));
    }
    request.getParameter("a1")可能是乱码。如果把“打开页面1”等于"open1"就可以。如何转换中文?