struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Hardy <>
Subject Re: I am getting frustrated with LookupDispatchAction
Date Tue, 18 Oct 2005 23:26:34 GMT

I like your code alot but a couple of things prevent me from purloining 
it for my own purposes:

firstly, I like to allocate my base class to sort out  user, locale, 
msgKeys, and messages objects for use in the subclass. It doesn't seem 
to be possible to sandwich a subclass in-between SelectAction and the 
child class to do this, isn't that so?

Secondly, getKeyMethodMap() looks really clunky - is there no way this 
can be pushed into the struts-config.xml?


Michael Jouravlev on 18/10/05 23:30, wrote:
> This action class is inspired by LookupDispatchAction, but it does not
> use property file and does not tie button caption to property name.
> Actually, it supports "parameter" to be compatible with original
> DispatchAction.
> On the other hand, if you think that hashmap brings an unnecessary
> overhead, then sticking method name directly into request key is
> simpler. No hashmaps, and clickable images are elegantly supported,
> but one can spot handler method name right from the browser, and
> rearrange the names names.
> If you don't care for visible method names, you can check out my
> version based on idea of parsing "dotted" request key:
> I first saw
> this parsing style on McGrady's website and borowed it from there. I
> am not pretending that this particuar idea is mine. The class from the
> link above has some comments here and there, and tries not to
> duplicate DispatchAction code.
> I think that this solution is compact and clean and could be a very
> good alternative/replacement to current DispatchAction, but I don't
> want to argue anymore on who stole from whom and why others can or
> cannot use it or why it cannot be included into Struts core.
> I needed a good dispatch action for my event-based library, I guess
> what I have now is good enough and allows to write well-structured
> code. Also, I get a level of indirection which hides actual method
> names from a user, so I will stick to what I have.
> Michael.
> On 10/18/05, Martin Gainty <> wrote:
>>Without a doubt this is the most intuitive page I have ever seen
>>I take it the lack of support for orphaned 'parameter' action attribute is
>>overcome with inserting map events to method handlers via HashMap such as
>>this example
>>protected Map getKeyMethodMap() {
>>     Map map = new HashMap();
>>     map.put(getInitKey()+"-ADD", "add");
>>     map.put(getInitKey()+"-DELETE", "delete");
>>     map.put(getInitKey()+"-CREATE", "create");
>>     map.put(getInitKey()+"-LOGIN", "login");
>>     return map;
>> }
>>//where methods are coded as
>>// Handler of Add button
>>      public ActionForward add(ActionMapping mapping,
>>                               ActionForm form,
>>                               HttpServletRequest request,
>>                               HttpServletResponse response)
>>            throws IOException, ServletException {
>>        System.out.println("--> add");
>>        return mapping.findForward("addpage");
>>      }
>>Very insightful..
>>----- Original Message -----
>>From: "Michael Jouravlev" <>
>>On 10/17/05, <> wrote:
>>>Hi.  I am using struts 1.2.7. My struts-config-xml file has the following:
>>><action path="/mywizard1"
>>>                name="wizardForm"
>>>            scope="session"
>>>            type="edu.nmsu.psl.userwizard.AddPSLUserWizardAction"
>>>            input="/step1.jsp"
>>>            validate="false"
>>>            parameter="method">
>>>                <forward name="next" path="/step2.jsp"/>
>>>        </action>
>>>my jsp has the following:
>>><html:submit property="method"><bean:message
>>>But I get the following error in tomcat:
>>>javax.servlet.ServletException: Request[/mywizard1] does not contain
>>>handler parameter named 'method'.
>>>Can someone save me from insanity?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message