On Tue, Sep 29, 2009 at 4:03 PM, Roger <roger.var...@googlemail.com> wrote: > Hi > > Apologies for the following, I hope it makes sense. > > I'm currently trying to develop a web-app that makes extensive use of > <s:select> elements in the UI. As I handed coded my n'th jsp implementation of > the same <select> today I thought I'd break out the tutorials and learn how to > create a custom tag to do this for me. And that got me thinking .. > > What I would like to know is if I can also "attach" a custom action to my > custom tag to populate the select options, without interfering with the rest > of the flow? So I would have a self contained "component". My limited > understanding of the Struts cycle suggests that once I'm into result > processing when my custom tag is processed it's too late to have a new > "action" on the stack.
Nah, your understanding is wrong here... You in fact can execute another action. Although I'm not a fan of it, check out the s:action tag. It will execute an action (and place it on the stack) while rendering the result of another action execution. > > I know that I could define a BaseAction that extends ActionSupport that my > action classes extend to provide a method to populate the select options, but > I'd end up with sub-classed actions that use the populate list method and some > for which the method would be meaningless, which doesn't feel right, and > having a BaseAction that is truely used by all actions (ie, setting up > logging) and then extending again with a BaseActionWithLists seems messy to > me, particularly when I have lists that are common to many actions, common to > few actions and those that are required by a single action. > > Of course, I could also have the design of the app horribly wrong .... > -Wes -- Wes Wannemacher Head Engineer, WanTii, Inc. Need Training? Struts, Spring, Maven, Tomcat... Ask me for a quote! --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org