This is a post the goes along with my previous message. I have a servlet in which I need to forward the request, however, I need to remove some of the values.

Brian Glodde

There are several ways to modify the HttpServletRequest. One simple way would be to redirect (rather than forward) the request using a querystring that contains the selected elements you need to pass:

String urlfwd = "yourpage.jsp?id=3&name=foo&name2=bar";
response.sendRedirect( urlfwd );
This gives you a chance to modify the incoming request variables and be selective about what you want to communicate to the next component or page.

You could go for the more complex scenario and use Filters. An explanation of servlet filtering would fill the page, so here are a couple links in the event you go this route:

» Java Boutique Servlet Filters Basic Tutorial
» A more technical explanation of filters
» Sun's "The Essentials of Filters"

Hope that helps!
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact