日期:2014-05-17  浏览次数:20771 次

求助 struts2 redirectaction 不能使用通配符
菜鸟刚学 Struts2 请各位高手指教一下 ,不慎感激~~~
XML code

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>

    <constant name="struts.enable.DynamicMethodInvocation" value="false" />
    <constant name="struts.devMode" value="true" />

     <package name="default" namespace="/" extends="struts-default">
        <action name="*">
            <result>
                /WEB-INF/jsp/{1}.jsp
            </result>
        </action>
    </package>
    
    <package name="controller" namespace="/Controller" extends="struts-default">
        <action name="*Controller" class="mvc.web.controller.login_register.{1}Controller">
            <result name="success">/WEB-INF/jsp/{1}_success.jsp</result>
            <!-- 下面这部分报错  <param name="actionName">{1}</param>  
                报错信息:Action {1} cannot be found in the namespace /
                                 把{1}活成*不报错,但是不是本意-->            
            <result  name="error" type="redirectAction" >
                <param name="actionName">{1}</param>
                <param name="namespace">/</param>
            </result>  
        </action>
    </package>
</struts>



------解决方案--------------------
肯定能用啊,<action name="*_*!*" class="{2}Action" method="{3}">
<result name="{1}">${floder}/{1}.jsp</result>
<result name="redirect" type="redirect">${url}</result>
<result name="error">/index.jsp</result>
<result name="errorupdate">/user/errorupdate.jsp</result>
<result name="buyerpwd">/trade/paypwd.jsp</result>
</action>