如何在一个页面同时实现增,删,改。

03-09-02 天下为公
现在遇到一个问题,利用struts framework 开发,,,

对于数据集 列表允许删除和修改,还要在同一一个页面实现添加,如何实现?

因为<html:form action>只能指定一个功能呀?

    

banq
2003-09-02 13:19
比较麻烦,关键是解决两个ActionForm在一个request中问题,

或者添加的表单不用Struts的html:form形式,直接使用html的form action

天下为公
2003-09-10 10:33
还有一个问题,在action中通过session来保存ArrayList(Element为formbean),可以实现方便的浏览列表,但是更改某条记录的属性值后,提交到服务端,修改的内容是否能自动保存到formbean,也就说我再通过sesseion就能得到最新的ArrayList

ruby
2003-09-11 09:22
使用DispatchAction.具体参考struts文档吧

An abstract Action that dispatches to a public method that is named by the request parameter whose name is specified by the parameter property of the corresponding ActionMapping. This Action is useful for developers who prefer to combine many similar actions into a single Action class, in order to simplify their application design.

To configure the use of this action in your struts-config.xml file, create an entry like this:

<action path="/saveSubscription" type="org.apache.struts.actions.DispatchAction" name="subscriptionForm" scope="request" input="/subscription.jsp" parameter="method"/> 

which will use the value of the request parameter named "method" to pick the appropriate "execute" method, which must have the same signature (other than method name) of the standard Action.execute method. For example, you might have the following three methods in the same action:

public ActionForward delete(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception 

public ActionForward insert(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception 

public ActionForward update(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception

and call one of the methods with a URL like this: http://localhost:8080/myapp/saveSubscription.do?method=update

天下为公
2003-09-12 09:53
谢谢楼上;能不能回答一下我的第2个问题,就是删除,和修改是直接在列表上做的,如何将修改的内容返回到后台!!!!!!!!!

猜你喜欢
3Go 1 2 3 下一页