配置文件里配代码<action name="findCSDN" method="findCSDN" class="cn.com.sinopec.joeco.zjy.action.CSDNAction">
<result>/csdn/csdnlist.jsp</result>
</action>这个result 就是指向你要跳转的jsp或者actionaction里面只需要 写 return SUCCESS; 就行是不是比1简单多了
<result>/csdn/csdnlist.jsp</result>
</action>这个result 就是指向你要跳转的jsp或者actionaction里面只需要 写 return SUCCESS; 就行是不是比1简单多了
解决方案 »
- 新手就指导啊
- java 字符串处理
- tomcat启动错,大虾们望望!!!
- webservice 老是链不上,还请各位SOA高手指点..
- 使用glassfish后还需要整合apache吗?
- SSH hibernate问题 one to many 新手 在线等
- JAVA中有没有和VC一样的RC5加密和解密算法
- 在线等待,求教关于MouseListener,MouseMotionListener具体实例的问题
- 接触过 java 和 .net 的朋友请进了
- J2EE及应用服务器(Weblogic,JRun,JBoss等)的关系问题
- 大家帮我研究一下这段java是什么意思呢?
- hibernate如何知道数据库是否已经启动
<global-results>
<result name="out">/WEB-INF/page/out.jsp</result>
</global-results>
<action name="product_*" class="productInfoAction"
method="{1}">
<result name="addproduct">
/WEB-INF/page/addproduct.jsp
</result>
<result name="showproducts">
/WEB-INF/page/showproduct.jsp
</result>
<!-- 被拦截器拦截后,会调用name为input的页面 返回 -->
<result name="input">/WEB-INF/page/addproduct.jsp</result>
</action>在struts2的ActionSupport里跳转的页面需要在result的标签对里配置.
<result-types>
<result-type name="dispatcher" class="com.opensymphony.webwork.dispatcher.ServletDispatcherResult" default="true"/>
<result-type name="redirect" class="com.opensymphony.webwork.dispatcher.ServletRedirectResult"/>
<result-type name="velocity" class="com.opensymphony.webwork.dispatcher.VelocityResult"/>
<result-type name="chain" class="com.opensymphony.xwork.ActionChainResult"/>
<result-type name="xslt" class="com.opensymphony.webwork.views.xslt.XSLTResult"/>
<result-type name="jasper" class="com.opensymphony.webwork.views.jasperreports.JasperReportsResult"/>
<result-type name="freeer" class="com.opensymphony.webwork.views.freeer.FreeerResult"/>
</result-types>
其大多都有location和parse两个参数,location指明action执行后接着去哪里,parse指明是否对location进行OGNL表达式解析。
1) dispatcher
action执行完后,请求会导向对应的View,Webwork2幕后其实是用RequestDispatcher来处理的,所以原Request/Response对象会接着传递,原Request中的Atrributes不会丢失,这点与下面的redirect是不同的。
2) redirect
对上次的响应将重定向到指定的位置,redirect是重新产生一个新的Request,原来Request保存的东西将不再有效,比如不能通过requet.getAtrribute 取得原来set的对象,也不能取得action的实例,errors,field errors等,因为Action是建立在Single-thread model上的。 3) chain
action链,特殊的View调用方式,一个action执行完接着调用另一个action。有个必须的参数actionName,指明紧接着调用的另一action对象。如:
<result name="success" type="chain">
<param name="actionName">bar</param>
<param name="namespace">/foo</param>
</result>
执行后接着调用下面的action:
<action name="bar" class="myPackage.barAction">
...
</action>
4) velocity
5) freeer
6) jasperreports
7) xslt
以上都是用不同技术的产生不同的View。
<action name="index">
<result>/login.jsp</result>
</action>