<action name="hello" class="com.hello"
method="addColumn">
<interceptor-ref name="defaultStack" />
<result name="input" type="chain">hello1</result>
<result name="success" type="chain">hello1</result>
</action>
<action name="hello1">
<interceptor-ref name="defaultStack" />
<result name="input">/MyJsp.jsp</result>
<result name="success">/MyJsp.jsp</result>
</action>
<action name="hello2" class="com.hello"
method="addColumn">
<interceptor-ref name="defaultStack" />
<result name="input" >/MyJsp.jsp</result>
<result name="success" >/MyJsp.jsp</result>
</action>在上面的那个配置中,访问hello2.action能够打印出<s:actionerror /><s:fielderror cssStyle="color:red" />,但是访问hello.action就是不行,求解,或者用其它方法解决这个问题也行,谢谢!

解决方案 »

  1.   

    是不是我打印的方式错了?我用的MyJsp.jsp写的是<%@ page language="java" contentType="text/html; charset=utf-8"%>
    <%@taglib prefix="s" uri="/struts-tags"%>
    <html>
    <head>
    <title>11111</title>
    <s:head />
    </head>
    <body>
    <s:actionerror />
    <s:fielderror cssStyle="color:red" />
    <s:property value="errors.groupName" />
    <s:debug></s:debug>
    </body>
    </html>
    高手看看怎么搞,谢谢啊
      

  2.   

    你可以通过在hello里的addColumn方法里跳转到hello1的action上
      

  3.   

    验证失败的话hello里的所有方法都不会执行吧?我那里有hello-validation.xml
      

  4.   

    1:访问hello.action --> 调用com.hello 中addColumn方法
    2:addColumn方法返回 input 或 sucess  根据返回值判断跳转哪一页(<result name=''/>)
    3: 假设第一次<action name='hello'/>中返回成功-->跳转hello1
    4:hello1中result 也是要求返回值判断的。没的明确的返回值转哪个?
    5:我记得result有个不用name属性的。
      

  5.   

    <action name="hello1">
            <interceptor-ref name="defaultStack" />
                <result name="input">/MyJsp.jsp</result>
                <result name="success">/MyJsp.jsp</result>    
    </action>action 还可以不写class 和 method ?我没这么做过啊,你加上试试还有没有错!你执行了hello.action后调用hello1.action是为了做什么呢?跳转到MyJsp.jsp页面吗?这样可以像hello2那种配置啊!
      

  6.   

    你加个命名空间试试,就namespace这个东西