<s:actionerror />
<s:fielderror cssStyle="color:red" />

<action name="hello" class="com.hello"> 
<result name="input">/MyJsp.jsp</result>
<result name="success">/MyJsp.jsp</result>
<interceptor-ref name="defaultStack" />
</action>
这样的条件下是能显示出来的,但是在经过了hello1.action后,就显示不出来了。
如有这么一些配置文件
<action name="hello" class="com.hello"> 
<result name="input">hello1</result>
<result name="success">hello1</result>
<interceptor-ref name="defaultStack" />
</action>
<action name="hello1" class="com.hello1">
<result name="input">/MyJsp.jsp</result>
<result name="success">/MyJsp.jsp</result>
<interceptor-ref name="defaultStack" />
</action>
当我在hello这个action里面产生了actionerror或者filederror之类的,怎么在hello1的MyJsp.jsp里面显示出来???
当我访问hello.action 它产生了actionerror或者filederror之类的,然后跳转到hello1.action,这里怎么显示?<s:actionerror />
<s:fielderror cssStyle="color:red" />
我不知道我说明白我的意思了没

解决方案 »

  1.   

    诶你 hello 执行input视图或者success视图 是再跳转到hello1这个 action?那你配置成 chain 模式吧<action name="hello" class="com.hello">  
    <result name="input" type="chain">hello1</result>
    <result name="success" type="chain">hello1</result>
    <interceptor-ref name="defaultStack" />
    </action>
    <action name="hello1" class="com.hello1">
    <result name="input">/MyJsp.jsp</result>
    <result name="success">/MyJsp.jsp</result>
    <interceptor-ref name="defaultStack" />
    </action>
      

  2.   

    3楼已经给出代码了。
    配置一下result的type属性,struts2中result有多种type属性给用户选择,相应的类容可以找资料看看。
      

  3.   

    我用过chain模式,而且配置和你给的差不多,在debug标签里面也能够找到相关的信息,但是就是显示不出来,所以才来求教的,你看看是不是还有问题,谢谢啊,唉,我的struts啊,愁人
      

  4.   

    恩,用3楼的方法过,但是没有显示出来,请教一下,是不是显示的时候还得换了,<s:actionerror />
    <s:fielderror cssStyle="color:red" />不行了?