You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Travis Stevens <Tr...@noaa.gov> on 2003/07/31 18:23:33 UTC
Design Question
Hello,
I have some functionality in my web application that allows a user to
select a record. This functionality is plugged into other types of
functions, such as combine a record or select a component record.
Steps to combine a record:
1. select a record
2. configure combining
3. combine
Sets to selct a compont
1. select a record
2. set the record as a component.
As you can see, the select a record functionality is common. To
implement this I would like to create action classes specifically for
the select a record interface. One of the request parameters would be
the action to forward the result to. The GET request would look
something like this:
/action/selectRecord?recordSetName=name&finishedForwardAction=/action/combineRecord
This would:
1. display search fields
2. search / display results
3. redirect to the finishedForwardActionPage (would it be better to put
the record in the session for the finshedForwardAction or just pass the
id as a parameter)
Is this an acceptable implementation, or is there a better way?
-Trav
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Design Question
Posted by Travis Stevens <Tr...@noaa.gov>.
Because the foward action should be completely dinamic. The select
action should know nothing concrete about any of the actions that use
the functionality, otherwise one would have to edit the select action
every time a new action is created that uses the select action.
shane@digitalsanctum.com wrote:
>Why not just define the forward action in the selectRecord action mapping
>element in your struts-config.xml?
>
>shane
>
>Quoting Erik Price <ep...@ptc.com>:
>
>
>
>>Travis Stevens wrote:
>>
>>
>>
>>>As you can see, the select a record functionality is common. To
>>>implement this I would like to create action classes specifically for
>>>the select a record interface. One of the request parameters would be
>>>the action to forward the result to. The GET request would look
>>>something like this:
>>>
>>>
>>>
>>>
>>/action/selectRecord?
>>
>>
>recordSetName=name&finishedForwardAction=/action/combineRecord
>
>
>>>This would:
>>>1. display search fields
>>>2. search / display results
>>>3. redirect to the finishedForwardActionPage (would it be better to put
>>>the record in the session for the finshedForwardAction or just pass the
>>>id as a parameter)
>>>
>>>
>>>Is this an acceptable implementation, or is there a better way?
>>>
>>>
>>I'm not saying that this is a better way, but it strikes me that
>>selecting a record might not be something that you want to confine to
>>Struts Actions -- for instance, someday down the road you might want to
>>select a record from some other interface or even as a service from
>>another application. You might wish to abstract this even further than
>>the level of Action, and make (for instance) a [POJO] class, such as
>>RecordSelector, that performs this activity.
>>
>>Then you can create Actions specific to your form interfaces, and when
>>it is necessary to select a record, you can use this class to do the
>>work (delegating the information from the Action to the class). This is
>>known as the Command design pattern (in fact Struts Actions are
>>themselves an implementation of the Command design pattern, but they are
>>tightly coupled to the servlet framework).
>>
>><http://www.dofactory.com/Patterns/PatternCommand.aspx>
>>
>>This may also spare you the process of supplying a parameter to indicate
>>which Action this should ultimately be forwarded to, since you would
>>just have the form submit to that Action and delegate the work to
>>RecordSelector from inside of that Action.
>>
>>Just a suggestion.
>>
>>
>>
>>Erik
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>>
>>
>>
>>
>
>
>
>
>----------------------------------------------------------------------
>This mail sent through Toaster-Horde (http://qmailtoaster.clikka.com/)
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Design Question
Posted by sh...@digitalsanctum.com.
Why not just define the forward action in the selectRecord action mapping
element in your struts-config.xml?
shane
Quoting Erik Price <ep...@ptc.com>:
>
>
> Travis Stevens wrote:
>
> > As you can see, the select a record functionality is common. To
> > implement this I would like to create action classes specifically for
> > the select a record interface. One of the request parameters would be
> > the action to forward the result to. The GET request would look
> > something like this:
> >
> >
> /action/selectRecord?
recordSetName=name&finishedForwardAction=/action/combineRecord
>
> >
> > This would:
> > 1. display search fields
> > 2. search / display results
> > 3. redirect to the finishedForwardActionPage (would it be better to put
> > the record in the session for the finshedForwardAction or just pass the
> > id as a parameter)
> >
> >
> > Is this an acceptable implementation, or is there a better way?
>
> I'm not saying that this is a better way, but it strikes me that
> selecting a record might not be something that you want to confine to
> Struts Actions -- for instance, someday down the road you might want to
> select a record from some other interface or even as a service from
> another application. You might wish to abstract this even further than
> the level of Action, and make (for instance) a [POJO] class, such as
> RecordSelector, that performs this activity.
>
> Then you can create Actions specific to your form interfaces, and when
> it is necessary to select a record, you can use this class to do the
> work (delegating the information from the Action to the class). This is
> known as the Command design pattern (in fact Struts Actions are
> themselves an implementation of the Command design pattern, but they are
> tightly coupled to the servlet framework).
>
> <http://www.dofactory.com/Patterns/PatternCommand.aspx>
>
> This may also spare you the process of supplying a parameter to indicate
> which Action this should ultimately be forwarded to, since you would
> just have the form submit to that Action and delegate the work to
> RecordSelector from inside of that Action.
>
> Just a suggestion.
>
>
>
> Erik
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
----------------------------------------------------------------------
This mail sent through Toaster-Horde (http://qmailtoaster.clikka.com/)
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Design Question
Posted by Erik Price <ep...@ptc.com>.
Travis Stevens wrote:
> As you can see, the select a record functionality is common. To
> implement this I would like to create action classes specifically for
> the select a record interface. One of the request parameters would be
> the action to forward the result to. The GET request would look
> something like this:
>
> /action/selectRecord?recordSetName=name&finishedForwardAction=/action/combineRecord
>
> This would:
> 1. display search fields
> 2. search / display results
> 3. redirect to the finishedForwardActionPage (would it be better to put
> the record in the session for the finshedForwardAction or just pass the
> id as a parameter)
>
>
> Is this an acceptable implementation, or is there a better way?
I'm not saying that this is a better way, but it strikes me that
selecting a record might not be something that you want to confine to
Struts Actions -- for instance, someday down the road you might want to
select a record from some other interface or even as a service from
another application. You might wish to abstract this even further than
the level of Action, and make (for instance) a [POJO] class, such as
RecordSelector, that performs this activity.
Then you can create Actions specific to your form interfaces, and when
it is necessary to select a record, you can use this class to do the
work (delegating the information from the Action to the class). This is
known as the Command design pattern (in fact Struts Actions are
themselves an implementation of the Command design pattern, but they are
tightly coupled to the servlet framework).
<http://www.dofactory.com/Patterns/PatternCommand.aspx>
This may also spare you the process of supplying a parameter to indicate
which Action this should ultimately be forwarded to, since you would
just have the form submit to that Action and delegate the work to
RecordSelector from inside of that Action.
Just a suggestion.
Erik
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org