I have few questiongs regarding forward mapping in Struts 1.2:
1) If I do a mapping.findForward("Yogesh") and there is no forward name defined in struts-config.xml. Then what will happen?
2) I guess, it will take me to a white page. What can i do so that it doesn't takes me to a white page, instead it says, no forward name with value Yogesh is defined in struts-config.xml. Please check.
Even if you able to show error message saying "no forward name with value Yogesh is defined in struts-config.xml. Please check." but this error message does not give any meaning to your for whom you are developing application. no point in showing this error to end user is only helps the developer, and developer can find this by debugging also.
Any ways still if you asked it for curiosity then this can be done by writing a custom request processor class where you can handle a condition for if returning a null forward by execute then show a Jsp with the error.
for getting details why we overridden this method then you need to go through a struts source.
there is also one way to do that,
write GenericAction extends Action, override a execute() method from action class, extends each action from your application by generic action.
Vaibhav G Garg
Joined: Sep 23, 2011
Thanks Shailest for your valuable inputs. It provides complete insight of the RequestProcessor / Action classes.
I tried changing the request processsor.
I created a CustomRequestProcessor as suggested and changed the entry in struts-config.xml as follows.
I get the following error when I build it in netbeans.
What else do I need to change.
Error occurred during deployment: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: javax.servlet.UnavailableException: TilesPlugin : Specified RequestProcessor not compatible with TilesRequestProcessor. Please see server.log for more details.
The module has not been deployed.
at sun.reflect.GeneratedMethodAccessor55.invoke(Unknown Source)
BUILD FAILED (total time: 7 seconds)
Joined: Dec 05, 2008
I needed to use
I don't know, why it worked, but this is how I was able to make it work.