structs2配置文件中返回success成功后,怎么让重定向的文件是可变的???

xsphello 2008-05-16 05:13:30
例如:
<action name="bookSave" class="com.gtjy.sitemanager.action.ProductAction" method="saveProduct">
<result name="success" type="chain">bookAdd?typeid=912</result>
<result name="error">error.jsp</result>
</action>
我这里想把bookAdd?typeid=912做成变量
现在如果是bookAdd后面不带typeid我可以实现
就是在action里定义个retpage变量,有set和get方法,然后在retpage="bookAdd"
<result name="success" type="chain">${bookAdd}</result>是可以的,如果retpage="bookAdd?typeid=912"这样就不对
或是<result name="success" type="chain">${bookAdd}?typeid=912</result>这样也不对,这问题怎么解决呀,谁知道,求救
...全文
199 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
风度玉门 2012-10-07
  • 打赏
  • 举报
回复
[col根据国际化or=#FF0000][/color]
xyingwd 2008-06-18
  • 打赏
  • 举报
回复
在两个action里设置两个同名的 变量,配上set get方法
action传递执行的时候会自动吧同名变量传递下去的。

如:
action1 中有个私有变量private int xxx 有get set
给他赋值
xxx = 111;
return SUCCESS;

<result name="success" type="chain">action2</result>



action2 中也有个私有变量 private int xxx 有get set 方法

System.out.println("xxx");
得到的结果就是 111
xsphello 2008-05-16
  • 打赏
  • 举报
回复
或是想写成 <result name="success" type="chain">${retpage}?typeid=${xid} </result>
这样的,可是不行呀
xsphello 2008-05-16
  • 打赏
  • 举报
回复
我是想要将
我这里想把bookAdd?typeid=912做成变量
想写成<result name="success" type="chain">${retpage} </result>
jayflee 2008-05-16
  • 打赏
  • 举报
回复
xid 是ProductAction类的成员。

<result name="success" type="chain">bookAdd?typeid=${xid}</result>
xsphello 2008-05-16
  • 打赏
  • 举报
回复
怎么没有人响应呢,大家心心好发发慈悲吧

67,513

社区成员

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

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