日期:2014-05-20  浏览次数:20694 次

Struts2.1、Spring3.0、Hibernate3.3框架整合遇到的问题
struts.xml遇到的问题
XML code
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
    <constant name="struts.objectFactory" value="spring"></constant>
    <package name="usermanage" extends="struts-default">
        <action name="addUser" class="UsersAction" method="addUser">
            <result name="success" type="redirect">listUser.action</result>
            <result name="error">/error.jsp</result>
        </action>
        <action name="editUser" class="UsersAction" method="editUser">
            <result name="success">/user/user_edit.jsp</result>
        </action>
        <action name="updateUser" class="UsersAction" method="updateUser">
            <result name="success" type="redirect">listUser.action</result>
            <result name="error">/error.jsp</result>
        </action>
        <action name="delUser" class="UsersAction" method="delUser">
            <result name="success" type="redirect">listUser.action</result>
            <result name="error">/error.jsp</result>
        </action>
        <action name="listUser" class="UsersAction" method="listUser">
            <result name="success">/user/user_list.jsp</result>
        </action>
        <action name="login" class="UsersAction" method="login">
            <result name="success">/index.jsp</result>
            <result name="input">/login.jsp</result>
            <result name="error">/error.jsp</result>
        </action>
    </package>

</struts>    



问题是:凡是有这个配置的都出现了错误提示
XML code
<result name="success" type="redirect">listUser.action</result>

提示是:Invalid result location value/parameter

------解决方案--------------------
使用redirect需要后缀名
使用redirect-action"不需要后缀名

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

重定向