aspose file tools*
The moose likes Servlets and the fly likes Changing the target attribute before making a forward Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Changing the target attribute before making a forward" Watch "Changing the target attribute before making a forward" New topic
Author

Changing the target attribute before making a forward

Andres Pineda
Greenhorn

Joined: Mar 06, 2002
Posts: 9
Hello, I need to change the target attribute of a form element (HTML) before calling the forward() method of a RequestDispatcher object from a servlet Admin in a MVC design pattern, That's because when I got a database error, I need to forward to an error page in a diferent frame from that the original form target specify. May be that's impossible but any idea or alternative solution would be thanks.


Andres Pineda
Asher Tarnopolski
Ranch Hand

Joined: Jul 28, 2001
Posts: 260
i'm not sure i understood what you wanna do, but in case i did... if you get an exception thrown you wanna redirect your page to some kind of "error" page. you can do it with your web.xml file (deployment descriptor). use this tag:
<error-page>
<exception-type>SomeKindOfException</exception-type>
<location>/iwrotebadcode.jsp</location>
</error-page>
try it.


Asher Tarnopolski
SCJP,SCWCD
Andres Pineda
Greenhorn

Joined: Mar 06, 2002
Posts: 9
thank you, I've solved my problem using an Error Applet that shows another page in a new window if an error ocurrs in the server side.
Thank you again
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Changing the target attribute before making a forward