Hi Frank,

I've been participating in discussions about the feature you proposed
since last year, and I've been looking to participate in its inclusion
into Struts.

> As you said, there did seem to be a lot of support for an idea along the
> lines of what I did, so it seemed like something that should have
> garnered more discussion and perhaps alternative proposals.

Joe most recently mention this sometime last month:
http://marc.theaimsgroup.com/?l=struts-dev&m=110842402707799&w=2

Aside from this, an email I sent to you (well, on the user list, but
on the thread where you mentioned this) also linked to a couple of
threads discussing this feature.  That mentioned a few alternatives,
including one from me.  I even noted that the message was almost a
year old.  :)
http://marc.theaimsgroup.com/?l=struts-user&m=111029587900454&w=2


> I am still very much interested in putting the time in, and I would be 
> more than happy to explore alternative ways of doing what I proposed.  I 
> am open to suggestion!!  To be honest, I haven't thought much about ways 
> this might be done as an "extension" to Struts... I'm not sure I see a 
> good way that would result in the same functionality in the same way 
> (which I believe to be a good approach, and many would seem to agree). 
> I am listening though! :)


The 1.3 support includes a change to the config DTD.  A 1.2 friendly
change could look something like:

<forward name="success" path="/page.jsp" 
    className="package.SpecificSetupActionForward"/>


package.SpecificSetupActionForward would either extend a
SetupActionForward, or implement a SetupActionForward.  In either
case, a setupView() method would be implemented/overridden.


The action's return could look like:

return ViewSetupUtil.setupForward("success", mapping, request);


ViewSetupUtil.setupForward() would call findForward("success"), check
if it's an instanceof SetupActionForward, then call the setupView()
method and pass the request.  Depending on what the setup entails, a
user may want to break it down into separate statements in the action
so he can check conditions and alternatively return a different
forward altogether.

If you want POJO support, you can do something like:

<forward name="success" path="/page.jsp" 
    className="package.SetupActionForward">
    <set-property property="setupClass" value="package.MyForwardSetup"/>
    <set-property property="method" value="setupMethod1"/>
</forward>

In this case, SetupActionForward would instantiate the named class and
call the method and pass parameters.  Either way, it'd work even
without any changes to Struts core.  :)

There are other variations that can be made, of course.

As far as sharing this to other people, I've done something similar
with http://www.rabago.net/struts/redirect/.  That one even involved a
custom request processor and the use of a base action.  And yes,
people actually use it.  :)  Of course, sometimes I also just point
them to an attachment I made to Bug 866.

Hubert

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to