public class SearchAction implements ModelDriven, PersistenceManagerAware { ...
public Object getModel() { // return one of UserSearchCriteria, LocationSearchCriteria, // VehicleSearchCriteria, etc. }
public String execute() { SearchCriteria criteria = (SearchCriteria)this.getModel(); SearchResult result = this.persistenceManager.search(criteria); ... } }
This turns out to be a really nice way to handle all sorts of different searches without having to write a new action for each.
The problem trying to implement this current is twofold.
1. currently the model is pushed onto the value stack before the ActionContext is set so the action doesn't have the opportunity to use either static or dynanmic parameters to help it makes its decision on which model to implement
2. the second issue is that currently, there is no way to distinguish whether or not a param is a static param or a dynamic param passed by the user
I see a couple of solutions to each and wanted to see if anyone else had an opinion.*
Solution 1 ----------
a. allow Actions to implement the Parameterizable interface. actions that implemented this interface would be passed the static parameters when the ActionInvocation is created
b. push the model onto the valuestack _after_ the ActionContext has been set
the drawback here is that it increases the amount of logic in the action invocation
Solution 2 ----------
a. migrate the pushing of the model onto the valuestack into a separate interceptor
b. optional, you could also modify the static parameters interceptor to look for the parameterizable interface and perform step a from Solution 1
the drawback here is that the interceptor stack must now be defined in a particular order or things break (static interceptor -> modeldriven interceptor -> parameters interceptor)
thoughts or other solutions?
M
------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01 _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork