[
http://issues.apache.org/struts/browse/STR-2903?page=comments#action_37661 ]
George Jempty commented on STR-2903:
------------------------------------
Wendy: that would apply to DispatchAction: MappingDispatchAction does not rely
on the request parameter, but rather the ActionMapping. If it's anywhere in
documentation for MappingDispatchAction, I would guess it was cut and pasted
from DispatchAction and not updated appropriately.
All:
If you can't tell I'm still in favor of adjusting the code, not the Javadoc ;)
I was very excited when I read how MappingDispatchAction works because of the
following. We already have an abstract action ("BaseCCAction") whose execute
method in turn delegates to a custom abstract "doWork" method. BaseCCAction
extends a BaseAction which extends Action. We thought we could have BaseAction
instead extend MappingDispatchAction, and then a colleague of mine and Chuck's
came up with the idea of simply having "unspecified()" delegate to our custom
"doWork()". This was going to allow us to switch to MappingDispatchAction
without having to change mappings: since our existing mappings do not specify a
parameter attibute, they should invoke "unspecified" and then in turn "doWork".
Except that MappingDispatchAction, since it's execute invokes DispatchAction's
execute, throws an error when there mapping.getParameter() returns null.
Therefore I get an error instead of the expected call to unspecified.
In fact, as written, I don't believe unspecified() CAN EVER be relied upon to
be called using MappingDispatchAction.
I know that Struts 1 is not the primary focus. I would however ask that before
making a firm decision to NOT patch, you allow Chuck and I to work out our
patch on our end?
TIA....George
> MappingDispatchAction throws an error when mapping.getParameter returns null
> ----------------------------------------------------------------------------
>
> Key: STR-2903
> URL: http://issues.apache.org/struts/browse/STR-2903
> Project: Struts 1
> Type: Bug
> Versions: 1.2.9
> Environment: Windows/Tomcat
> Reporter: George Jempty
> Attachments: MappingDispatchAction.patch.txt
>
> The JavaDoc for MappingDispatchAction states that unspecified() is the
> "method which is dispatched to when there is no value for the parameter in
> the ActionMapping." When I don't specify "parameter" in the ActionMapping
> however, I get the following stack trace:
> ERROR [http-8080-Processor24] (BaseCCAction.java:66) -
> DispatchMapping[/msalogin] does not define a handler property
> javax.servlet.ServletException: DispatchMapping[/msalogin] does not define a
> handler property
> at
> org.apache.struts.actions.DispatchAction.getParameter(DispatchAction.java:325)
> at
> org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:170)
> at
> org.apache.struts.actions.MappingDispatchAction.execute(MappingDispatchAction.java:169)
> at
> com.cypresscare.web.common.actions.BaseCCAction.execute(BaseCCAction.java:60)
> at
> org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
> My investigation shows that this is due to MappingDispatchAction's execute()
> method doing nothing except delegating to DispatchAction's execute() method:
> public ActionForward execute(
> ActionMapping mapping,
> ActionForm form,
> HttpServletRequest request,
> HttpServletResponse response)
> throws Exception {
>
> // Use the overridden getMethodName.
> return super.execute(mapping, form, request, response);
> }
> Furthermore, as evident from my attached stack trace, it is the overridden
> getParameter() that actually needs to be used
> HTH
> George Jempty (ps my manager is Chuck Cavaness!!)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira