struts2的action问题

隐藏起来 2010-11-15 04:28:40
<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" />
我不知道我说明白我的意思了没
...全文
104 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
隐藏起来 2010-11-16
  • 打赏
  • 举报
回复
在线等解答
隐藏起来 2010-11-15
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 lkclkc88 的回复:]
3楼已经给出代码了。
配置一下result的type属性,struts2中result有多种type属性给用户选择,相应的类容可以找资料看看。
[/Quote]
恩,用3楼的方法过,但是没有显示出来,请教一下,是不是显示的时候还得换了,<s:actionerror />
<s:fielderror cssStyle="color:red" />不行了?
隐藏起来 2010-11-15
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 magicluo 的回复:]


你 hello 执行input视图或者success视图 是再跳转到hello1这个 action?

那你配置成 chain 模式吧

XML code

<action name="hello" class="com.hello">
<result name="input" type="chain">hello1</result>
<result name="su……
[/Quote]
我用过chain模式,而且配置和你给的差不多,在debug标签里面也能够找到相关的信息,但是就是显示不出来,所以才来求教的,你看看是不是还有问题,谢谢啊,唉,我的struts啊,愁人
  • 打赏
  • 举报
回复
3楼已经给出代码了。
配置一下result的type属性,struts2中result有多种type属性给用户选择,相应的类容可以找资料看看。
xiaohuanjie 2010-11-15
  • 打赏
  • 举报
回复
看是看懂了,就是不会
magicluo 2010-11-15
  • 打赏
  • 举报
回复


你 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>

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧