Very cool :)

However, I am hesitant to depend even on DynaBean.  What if I want to use a
normal POJO bean?  Here's what I'm thinking of doing:

IInputForm.java:
public interface IInputForm { }

IDynaInputForm.java:
public itnerface IDynaInputForm extends IInputForm {
   public Object get(String name);
   public void set(String name, Object object);
   /* and maybe some other getters/setters like the
   ones in DynaActionForm */
}

MyDynaValidatorForm.java:
public MyDynaValidatorForm extends DynaValidatorForm implements
IDynaInputForm { }

Now my execute method becomes (* added for emphasis):
public List execute(*IInputForm* form, ISecurityInfo info)

Now I'm not depending on any APIs other than my own :)

What do you think?  BTW, I like that you have methods that test if a user is
in a role in your WebSecurityHolder class.  I have no clue how this didn't
occur to me earlier, and will be adding this to my API in the next few
minutes.

Matt
----- Original Message ----- 
From: "Mainguy, Mike" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Thursday, September 25, 2003 10:28 AM
Subject: RE: [Poll] action mappings


> That is exactly the method signature I use (well, different names, but
> exactly the concept).  I actually use
> +++
> Public string commandParameter = "ProjectAction"
> Public List commandFoo(DynaBean bean, WebSecurityHolder security) {
>       ..do stuff..
> return ArrayList (or whatever) with a bunch of DynaBeans
> }
> Public DynaBean commandFoo(DynaBean bean, WebSecurityHolder security) {}
> +++
>
> Where Foo is the name of a request parameter. I have another class that
acts
> as a broker and maps the request parameters to these command objects.
>
> The end result is for a request /servlet.do?ProjectAction=Foo
> My BaseActionClass will automagically invoke the method Foo.  In addition,
> the websecurityholder has a simple method to allow you to query if the
user
> is in a specific role.
>
> The cool thing is that if you use DynaForms (or DynaValidatorForms) you
can
> map a sql query straight into a DynaBean (or a list of) using BeanUtils
and
> therefore get automagic form population without a lot of muss and fuss.
>
> I agree that #3 is probably better, but it seems that #1 is pretty popular
> and I want to make sure I'm not missing some significant advantage to
doing
> it that way.
>
> -----Original Message-----
> From: Sgarlata Matt [mailto:[EMAIL PROTECTED]
> Sent: Thursday, September 25, 2003 10:14 AM
> To: Struts Users Mailing List
> Subject: Re: [Poll] action mappings
>
>
> OK, I think I understand #1 now.  However, I still disagree with it ;)  If
> you are using the same form bean and display components, you can define a
> single action mapping and thus eliminate duplicate configuration
information
> in the struts-config file.  I am a zealot when it comes to violations of
the
> DRY (don't repeat yourself) principle, so in my opinion #3 is superior to
> #1.  Before I get flamed on my strong stance here, let me just mention
that
> I do understand #3 is unworkable if you need to use different form beans
for
> some reason.
>
> I like your variant of DispatchAction, and will likely do something
similar
> myself soon.  So your Command class has a signature something like below,
> right?
>
> public List execute(ActionForm form, ISecurityInfo info)
>
> One issue I have been grappling with over the last couple days is whether
> your're really decoupling yourself from the Web by using an ActionForm as
> your transfer object.  The ActionForm class seems pretty tightly coupled
to
> the servlet API to me.  Sure its methods don't return or take as
parameters
> anything directly from the javax.servlet.* API, but it does return
> references to things like the ActionServlet which clearly are dependent on
> the servlet API.  Thoughts?
>
> Matt
> ----- Original Message ----- 
> From: "Mainguy, Mike" <[EMAIL PROTECTED]>
> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
> Sent: Thursday, September 25, 2003 9:59 AM
> Subject: RE: [Poll] action mappings
>
>
> > You don't have to create a different ActionClass for every Operation
> > with the same display/FormBean...  I.E.  If you use the same formbean
> > and
> display
> > component, you don't want to also always create another ActionClass...
> >
> > Similar to dispatchaction except you use the pathmapping instead of
> > the request parameters.
> >
> > I actually wrote a variant of dispatchAction that, instead of calling
> > a specific execute method on my ActionClass, it maps the request to
> > another Command style class that performs an operation with only the
> > FormBean and
> a
> > security context as the input, and a List or DynaBean as the output.
> > This let me completely decouple my data access layer from any web
> > stuff and use request parameters to determine which business operation
> > I was performing.
> >
> >
> > -----Original Message-----
> > From: Sgarlata Matt [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, September 25, 2003 9:54 AM
> > To: Struts Users Mailing List
> > Subject: Re: [Poll] action mappings
> >
> >
> > I think for #3 it would be silly not to use a DispatchAction or
> > LookupDispatchAction, right?  It seems like you would also want
> > DispatchAction or LookupDispatchAction for #1, but I really don't
> understand
> > why people are using #1 at all.  Is there some reason multiple action
> > mappings are needed for the same Action?
> >
> > Matt
> > ----- Original Message -----
> > From: "Mainguy, Mike" <[EMAIL PROTECTED]>
> > To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
> > Sent: Thursday, September 25, 2003 9:47 AM
> > Subject: RE: [Poll] action mappings
> >
> >
> > > So far the results are as follows:
> > >
> > > #1 5
> > > #2 1
> > > #3 2
> > > #4 0
> > >
> > > I added myself to both 1 and 3 as I've done a project both ways...
> > > Now I wonder, how does everyone determine which operation you are
> > > doing?  As a parameter in the action mapping?  A big case-style (if
> > > else) statement?
> > >
> > > -----Original Message-----
> > > From: Mainguy, Mike [mailto:[EMAIL PROTECTED]
> > > Sent: Tuesday, September 23, 2003 11:06 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: [Poll] action mappings
> > >
> > >
> > > I have yet another opinion poll for struts-user...
> > >
> > > What are folks currently doing for action mappings in relation to
> > > CRUD operations? Are you:
> > >
> > > #1  creating a unique Action mapping for each atomic operation
> > >     (potentially mapped to the same action class)
> > > /createUser.do     ->>  UserAction.java
> > > /readUser.do       ->>  UserAction.java
> > > /updateUser.do     ->>  UserAction.java
> > > /deleteUser.do     ->>  UserAction.java
> > >
> > >
> > > #2  creating a unique Action mapping for each atmoic operation
> > >     with each action having a unique class
> > > /createUser.do     ->>  CreateUserAction.java
> > > /readUser.do       ->>  ReadUserAction.java
> > > /updateUser.do     ->>  UpdateUserAction.java
> > > /deleteUser.do     ->>  DeleteUserAction.java
> > >
> > > #3  creating an aggregate action class with a unique action mapping
with
> > >     multiple operations and using form/request variable to
> > > accomplish
> CUD
> > > /editUser.do       ->> UserAction.java   (?OP=Update, ?OP=Create,
> > > ?OP=Delete)
> > > /displayUser.do    ->> UserAction.java
> > >
> > >
> > > #4  creating an aggregate action class with a unique action mapping
with
> > >     multiple operations
> > > /editUser.do       ->> EditUserAction.java
> > > /displayUser.do    ->> DisplayUserAction.java
> > >
> > >
> > > Some other way (or a combination) ...
> > >
> > >
> > >
> > > This message and its contents (to include attachments) are the
> > > property of Kmart Corporation (Kmart) and may contain confidential
> > > and proprietary information. You are hereby notified that any
> > > disclosure, copying, or distribution of this message, or the taking
> > > of any action based on information contained herein is strictly
> > > prohibited. Unauthorized use of information contained herein may
> > > subject you to civil and criminal prosecution and penalties. If you
> > > are not the intended recipient, you
> > should
> > > delete this message immediately.
> > >
> > >
> > >
> > >
> > > --------------------------------------------------------------------
> > > -
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> > > This message and its contents (to include attachments) are the
> > > property of
> > Kmart Corporation (Kmart) and may contain confidential and proprietary
> > information. You are hereby notified that any disclosure, copying, or
> > distribution of this message, or the taking of any action based on
> > information contained herein is strictly prohibited. Unauthorized use
> > of information contained herein may subject you to civil and criminal
> > prosecution and penalties. If you are not the intended recipient, you
> should
> > delete this message immediately.
> > >
> > >
> > >
> > > --------------------------------------------------------------------
> > > -
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> > This message and its contents (to include attachments) are the
> > property of
> Kmart Corporation (Kmart) and may contain confidential and proprietary
> information. You are hereby notified that any disclosure, copying, or
> distribution of this message, or the taking of any action based on
> information contained herein is strictly prohibited. Unauthorized use of
> information contained herein may subject you to civil and criminal
> prosecution and penalties. If you are not the intended recipient, you
should
> delete this message immediately.
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> This message and its contents (to include attachments) are the property of
Kmart Corporation (Kmart) and may contain confidential and proprietary
information. You are hereby notified that any disclosure, copying, or
distribution of this message, or the taking of any action based on
information contained herein is strictly prohibited. Unauthorized use of
information contained herein may subject you to civil and criminal
prosecution and penalties. If you are not the intended recipient, you should
delete this message immediately.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to