It should be noted that JPetStore also performs multiple "actions" per form. The difference is that with BeanAction, you must call a different URL for each "action". (I quote action, as there is obviously only one actual Action class...).
Clinton
On 5/12/05, Lieven De Keyzer <[EMAIL PROTECTED]> wrote:
>From: Brandon Goodin <[EMAIL PROTECTED]>
>Reply-To: Brandon Goodin <[EMAIL PROTECTED]>
>To: ibatis-user-java@incubator.apache.org
>Subject: Re: [OT] JPetStore - BaseBean / BeanAction
>Date: Thu, 12 May 2005 19:01:02 -0600
>
>i'm not sure about your "formAction" semantic. You should name it
>something meaningful like "removeFoo". The method names should be
>named after the actions that are taking place.
Yes, I should have given my real problem instead of this one. But that would
mean my action would be called: folderActions. And the methods foo and bar
would be: remove and edit.
>But, yes you would follow the same semantic. You need to realize that
>JPetstore is NOT
>standard struts practice. It is a way to use struts in a more modern
>manner (i.e. Action has properties on it rather than sepearate in an
>ActionForm.).
And I like this modern way better than the old one. :)
>Otherwise, it sounds like you have the idea down fairly well.
>
>Brandon
>
>On 5/12/05, Lieven De Keyzer <[EMAIL PROTECTED] > wrote:
> > I took the lastest JPetStore as a starting point for my application.
> >
> > The problem I have now: I want to have multiple actions in one form. I
>have
> > a set of objects belonging to a user and this are displayed together
>with a
> > checkbox for each object. I want the users to be able to check a few
>boxes
> > and let them choose to delete those, or edit them all at once, etc...
> >
> > Normall I think one should implement a class that inherits from the
> > DispatchAction Class.
> >
> > I guess using the BaseBean and BeanAction class, this should even be
> > simpler. Should I use the same tactic as the DispatchAction class uses ?
> > Something like:
> >
> > public Class TreeLevel extends BaseBean {
> >
> > private String method;
> >
> > public String formAction {
> > if (method == "foo") {
> > return foo(); }
> > else { return bar(); }
> > }
> >
> > private String foo() {
> > //
> > }
> >
> > private String bar() {
> > }
> > }
> >
> > And then in my jsp page:
> >
> > <html:form action="">> > <html:submit property="method" value="foo" />
> > <html:submit property="method" value="bar" />
> > </html:form>
> >
> >