I think what's happening here is that you're actually returning null (you
looked up a non-existing ActionForward in the ActionMapping, which returns
null), which tells the ActionServlet that you've already taken care of that
request and no forward is necessary (i.e. you're spitting back a
downloadable file or an image or something). That's why the result comes
back blank with nothing in it, because it IS blank! Anyway, defining
unknown="true" won't fix this problem. The unknown="true" is for when a
request comes in that maps to the ActionServlet and the ActionServlet can't
map that to an Action. That's when the "unknown" action kicks in.
-----Original Message-----
From: bill.manuel@xxxxxxxxxx [mailto:bill.manuel@xxxxxxxxxx]
Sent: Friday, December 10, 2004 3:22 PM
To: users@xxxxxxxxxx
Subject: Re: [cinjug-users] Struts question: how do you handle an undefined
ActionForward value?
I handle this problem like list:
In the method in your action class that is executing, create a variable
ActionForward forward = mapping.findForward("someDefaultForward");
This variable gets returned at the end of the method: return forward;
Anywhere in the method you can return with any ActionForward that you want,
but at least you have a default forward to fall back on. Make sure this
default forward is listed in your struts-config under either the action or
the global forward.
Bill Manuel
Sun Certified Web Component Developer
bill.manuel@xxxxxxxxxx
Brian K Bonner
<brian.bonner@par
aware.com> To
users@xxxxxxxxxx
12/10/2004 03:01 cc
PM
Subject
Re: [cinjug-users] Struts question:
Please respond to how do you handle an undefined
users@xxxxxxxxxx ActionForward value?
Good question.
You're basically returning a null ActionForward from your Action, because
the page is not found by the ActionMapping. It *is* because you have a
programming error in your app.
You could subclass ActionMapping to return an error page if a forward is
not found (to help you as the programmer). What do other struts folks do?
Brian
steve.gutter@xxxxxxxxxx wrote on 12/10/2004 01:09:06 PM:
>
> Granted that it shouldn't happen, but how do you handle the circumstance
> when the ActionModel class's
> execute method returns an ActionForward value which is not defined as a
> forward name= value
> in the ActionModel's action definition in struts-config.xml?
>
>
> It causes the app to go to a blank page, but no exceptions, etc. are
> thrown.
>
> I'm using the action entry with unknown="true" for the case where I have
an
> href="xyz.do" and there is no
> action defined for /xyz (which, again, granted shouldn't happen), but
this
> doesn't catch the other scenario.
>
>
> ---------
> You may unsubscribe from this mailing list
> by sending a blank email addressed to:
> users-unsubscribe@xxxxxxxxxx
>
> --
> Find additional help by sending a blank email
> addressed to:
> users-help@xxxxxxxxxx
>
---------
You may unsubscribe from this mailing list
by sending a blank email addressed to:
users-unsubscribe@xxxxxxxxxx
--
Find additional help by sending a blank email
addressed to:
users-help@xxxxxxxxxx
---------
You may unsubscribe from this mailing list
by sending a blank email addressed to:
users-unsubscribe@xxxxxxxxxx
--
Find additional help by sending a blank email
addressed to:
users-help@xxxxxxxxxx
|