1.action的配置
<action name="login" class="com.linj.DAO.LoginAction" method="execute">
2.result的配置
<result-types>
<result-type name="chain" class="com.opensymphony.xwork2.ActionChainResult"/>
<result-type name="dispatcher" class="org.apache.struts2.dispatcher.ServletDispatcherResult" default="true"/>
<result-type name="freemarker" class="org.apache.struts2.views.freemarker.FreemarkerResult"/>
<result-type name="httpheader" class="org.apache.struts2.dispatcher.HttpHeaderResult"/>
<result-type name="redirect" class="org.apache.struts2.dispatcher.ServletRedirectResult"/>
<result-type name="redirectAction" class="org.apache.struts2.dispatcher.ServletActionRedirectResult"/>
<result-type name="stream" class="org.apache.struts2.dispatcher.StreamResult"/>
<result-type name="velocity" class="org.apache.struts2.dispatcher.VelocityResult"/>
<result-type name="xslt" class="org.apache.struts2.views.xslt.XSLTResult"/>
<result-type name="plainText" class="org.apache.struts2.dispatcher.PlainTextResult" />
</result-types>
chain:指action链,链接下一个action;执行actionA以后直接执行ActionB后直接执行ActionC,用得较少
地址栏是执行的第一action
***dispatcher:转发;和servlet一致。如果request中有数据要到视图显示,那么使用dispatcher
***redirect:重定向;如果是重定向到jsp页面,可以直接重定向,如果是重定向到另一个action,需注意
是否配置了action的后缀名。如果要求有后缀名,那么重定向的action一定要加上后缀名
***redirectAction:重定向导另一个action;不用加action的后缀名,会将前一个action的后缀名自动加上
***stream:以流的形式显示-文件下载