struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wes Wannemacher <w...@wantii.com>
Subject Re: Struts 2 Custom Tags & Custom Actions
Date Tue, 29 Sep 2009 19:55:20 GMT
On Tue, Sep 29, 2009 at 4:27 PM, Roger <roger.varley@googlemail.com> wrote:
>> > 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.
>>
> Hi Wes
>
> Thanks for the quick response. Given that you're not a fan of the <s:action>
> tag, would you care to elaborate on why, pitfalls etc etc. Am I trying
> something unreasonable here and is there a better way of achieving what I'm
> trying to do.

My problem with s:action is that the implementation has been a buggy
in the past. It seems like it would be a simple task to place another
action invocation on the top of the stack, temporarily, execute it,
then pop it off the stack, but, like I said, it's been buggy in the
past.

Don't take that as a reason not to try it... It seems your use-case is
pretty simple and it is exactly the kind of use it was meant for.

> As an aside, if I do go down the <s:action> route to a custom
> "populate the list" action, what do I return as the result so I don't
> interfere with the flow.

I could be wrong, but isn't there an Action.NONE ? I would try that,
or SUCCESS. As long as you don't set 'executeResult="true"' then it
shouldn't interrupt the flow...

Another approach would be to populate your select with ajax or just
use an ajax autocompleter. (just a thought)

-Wes

-- 
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message