> From: Brian Sayatovic/AMIG [mailto:[EMAIL PROTECTED]
> That's exactly my point.
> If there is no "submit=xxx" parameter/value to the action,
> then it throws
> a NullPointerException. So my action works like this:
> /admin/list.do?submit=Refresh
> But not like this:
> /admin/list.do
> So, is the answer:
> (a) I should never use the second form because it is evil
> (b) I could use the second form but its broken in LookupDispatchAction
> (c) something else?
What version of Struts are you using? I suspect you're on 1.1 or
something older than a nightly build. The javadocs on the Struts site
go with the nightly builds.
The unspecified method is in DispatchAction, and is inherited by
LookupDispatchAction, so you won't find it in the LDA source code. It's
actually the protected 'dispatchMethod' code that handles the null:
// Make sure we have a valid method name to call.
// This may be null if the user hacks the query string.
if (name == null) {
return this.unspecified(mapping, form, request, response);
}
If unspecified does not work for a missing parameter in your version of
struts, (it does in 1.2.0 and probably somewhat before that,) either
move to a newer version of Struts, or override 'execute' to provide
default behavior. Check for the presence of the request parameter, if
it exists, call super.execute(), if not, do your default behavior,
probably by calling one of the methods in your LDA.
The reason you're getting conflicting answers is that some of us are
using new builds where unspecified works fine, and some are on other,
older versions. The nightly builds are very stable, I recommend them
and have no problems using them in production.
--
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]