想问问,struts1与struts2如何实现这样的功能,方法越多越详细越好。

解决方案 »

  1.   

    你可以在配置文件里配置跳转
    如:
    <action path="/distributor/delete" type="com.gs.web.esmcol.distributor.DistributorDeleteAction"  parameter="method" >
    <forward name="list" path="/distributor/list.do?method=formSubmit"/>
    </action>
      

  2.   

    struts1的很简单啊,就像你跳转到其他页面的方法一样。
    struts2的你只要在<result name="xxx" type="chain">actionname</result>网上这类方法一大堆呢。。随便搜搜就行了,还有源码
      

  3.   

    s1:    1:  <result name="success" type="redirect">register.action </result>  
            2:  return new ActionForward("/myaction.do?userid="+userid + "&teamUser="+teamUser + "&doEdit="+doEdit);  
            3:  <result name="success" type="chain" >action 名称 </result>  s2:   <result name="success" type="chain" >action 名称 </result>  
          <result name="success" type="redirect-action" >actionName</result>  
      

  4.   

    三楼正解。但是建议google里搜搜
      

  5.   

    MyAction继承ActionSupport后,return "input",能直接转到my-input.jsp;不须要配置,在这样情况下如何跳转转。
      

  6.   

    三楼正解,ps,别用s1了,除非support
      

  7.   

    本人强烈建议你使用struts2,因为那样的话比struts1强太多了,这几个就够你用了
    <struts>
    <constant name="struts.objectFactory " value="spring"></constant>
    <constant name="struts.i18n.encoding" value="utf-8"></constant>
    <package name="" extends="struts-default" >   
    <action name="login" class="userAction" method="saveUser">  
    <result name="success">welcome.jsp</result>
    <result name="error">error.jsp</result>
    </action>
    <action name="userlogin" class="userAction" method="loginUser">
    <result name="success">welcome.jsp</result>
    </action>
      </package>
    </struts>
      

  8.   

    我用的不是struts2啊!!同胞们。
      

  9.   

    <result name="success" type="redirect-action" >actionName</result>
      

  10.   

    struts2 Action之间的跳转有方式:
    (1):chain,<result type="chain">...</result>,顾名思义,这种请求方式是通过拦截器ChainingInterceptor完成的,Action链在ChainingInterceptor执行完源码后,将原Action中的用户请求参数,值栈,session的数据自动赋值为目标Action,简单的说法,也就是在执行多个action过程中,参数都是保留的。
    (2)redirect,<result type="redirect">...</result>,这个没什么说的,都懂的。redirect结果类型与Struts2框架默认的结果类型dispatcher相对应。 到dispatcher类型是将请求转发到指定的视图资源,而redirect类型是重定向到指定的视图资源。重定向将会丢失所有的参数、值栈和请求属性,即同时失去了Action的处理结果。而dispatcher是类型转发,将会把上述的所有数据资源转发给视图资源
    (3) redirect-action,<result type="redirec-actiont">...</result>,redirect-action结果类型与redirect结果类型非常相似,都是重新生成一个新的请求,都是重新定向。  
      

  11.   

    struts2
    配置文件里<action name="bbbbbbbbbbbbbbbbb" class="" method="">
       <result name="success">/xxxx.jsp</result>
    </action><action name="aaaaaaaaaaa" class="" method="">
       <result name="success">bbbbbbbbbbbbbbbbb</result>
    </action>
      

  12.   

    struts1的没有研究过,不过struts2的方法是在struts.xml文件里面某个action里面result配置成:
    <result name="xxx" type="chain"> actionname </result>
    关键是chain属性,是一个action转到另外一个action的方法,其次还有
    dispatcher:服务器跳转
    redirect:客户端重定向
    chain:action互转
      

  13.   

    我刚刚弄了这个东西,就贴上来给你,不知道是不是你想要的
    从com.liuhe.action.IndexAction跳转到com.liuhe.action.OpenAction的openTimeShow
    <action name="*" class="com.liuhe.action.IndexAction" method="{1}">
    <result name="kfp" type="chain">
    <param name="namespace">/open</param>
    <param name="actionName">openTimeShow</param>
    </result>
    <result name="*">/${result}.jsp</result>
    </action>