struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Travis Stevens" <Travis.Stev...@noaa.gov>
Subject Re: Design Question
Date Thu, 31 Jul 2003 17:53:07 GMT
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 <eprice@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


Mime
View raw message