wood burning stoves
The moose likes Struts and the fly likes Query Regarding Forward Mapping in Struts 1.2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Query Regarding Forward Mapping in Struts 1.2" Watch "Query Regarding Forward Mapping in Struts 1.2" New topic

Query Regarding Forward Mapping in Struts 1.2

Vaibhav G Garg
Ranch Hand

Joined: Sep 23, 2011
Posts: 141
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.
Shailesh Narkhede
Ranch Hand

Joined: Jul 10, 2008
Posts: 368
Hi Vaibhav,

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
Ranch Hand

Joined: Sep 23, 2011
Posts: 141
Thanks Shailest for your valuable inputs. It provides complete insight of the RequestProcessor / Action classes.
Yogesh Gandhi
Ranch Hand

Joined: Dec 05, 2008
Posts: 219
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 org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:210)
at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:106)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor55.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:284)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:539)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
BUILD FAILED (total time: 7 seconds)
Yogesh Gandhi
Ranch Hand

Joined: Dec 05, 2008
Posts: 219
I needed to use

instead of

I don't know, why it worked, but this is how I was able to make it work.

I agree. Here's the link: http://aspose.com/file-tools
subject: Query Regarding Forward Mapping in Struts 1.2
It's not a secret anymore!