Topic: 在tiles中处理多个提交按扭的问题

  Print this page

1.在tiles中处理多个提交按扭的问题 Copy to clipboard
Posted by: cnlf
Posted on: 2005-04-18 09:01

大家早,问个tiles的问题:
我在 tiles-def.xml定义了:
<definition name="base-definition" path="/layout.jsp">
<put name="sidebar" value="sidebar-definition" type="definition"/>
<put name="header" value="header-definition" type="definition"/>
<put name="content" value=""/>
<put name="footer" value="footer.jsp"/>
<definition>

<definition name="index-definition" extends="base-definition">
<put name="content" value="index-content.jsp"/>
</definition>

因为我的index页面要处理多个业务操作(有多个提交按纽),因此我使用了Big SmileispatchAction来处理,struts-config.xml中DispatchAction的配置如下:
<action path="/index"
type="org.apache.struts.actions.DispatchAction"
scope="request"
parameter="method"> <!--问题出在这里-->
<forward name="success" path="/success.do" redirect="true"/>
</action>
但是要在struts-config.xml中使用tiles的定义要求在action中定义的parameter参数中指定模板的名字比如:
<action path="/index"
parameter="index-definition">
</action>
由于都用到了parameter参数,请问我改怎么办呢?

2.Re:在tiles中处理多个提交按扭的问题 [Re: cnlf] Copy to clipboard
Posted by: floater
Posted on: 2005-04-18 09:21

tile reference should be inside the action:
<forward name="success" path="index-definition"/>

3.Re:在tiles中处理多个提交按扭的问题 [Re: cnlf] Copy to clipboard
Posted by: cnlf
Posted on: 2005-04-18 09:50

你可能没有看清我的问题,问题在这里:
<action path="/index"
type="org.apache.struts.actions.DispatchAction"
scope="request"
parameter="method"> <!--问题出在这里-->
由于tiles和 DispatchAction都要用到parameter参数,我不知道该怎么办.

4.Re:在tiles中处理多个提交按扭的问题 [Re: cnlf] Copy to clipboard
Posted by: floater
Posted on: 2005-04-18 09:55

that's why I said, you should move your tile definition to the child forward, rather than in the action.

Also, 多个业务操作(有多个提交按纽) --> DispatchAction, in my view, this is not a good way to do things. Seperate them to diff actions.

If I am wrong, let me know.

5.Re:在tiles中处理多个提交按扭的问题 [Re: cnlf] Copy to clipboard
Posted by: cnlf
Posted on: 2005-04-18 10:04

上面只是我举的一个例子,关键是我要知道怎么在tiles中使用DispatchAction,我也想在一个页面只使用一个提交按钮,但是需求已经做完,要求有一个页面有多个提交按钮,例如:上面一个"查询"按钮,下面一个"提交"按钮.

6.Re:在tiles中处理多个提交按扭的问题 [Re: cnlf] Copy to clipboard
Posted by: floater
Posted on: 2005-04-18 10:27

one button to one action/form, you have 10 buttons, then 10 actions/forms.

7.Re:在tiles中处理多个提交按扭的问题 [Re: cnlf] Copy to clipboard
Posted by: cnlf
Posted on: 2005-04-18 10:46

我明白了,谢谢你了.


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923