This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
My requirement is that when iam redirecting through pages my url is like hostname/index.jsp or hostname/sucess?id=22. ow my requirement is the values should be hidden and it should be replace with the title of that page.
Thanks in advance
What you want to do is make your requests to a servlet and let the servlet forward to the correct page. That way the URL will only show the name of the servlet and not the page. This is the correct way to build a JSP application, by the way. All requests should always go through a controlling servlet; never call a jsp page directly. In fact, I've recently started building all my apps with the jsps stored under the WEB-INF folder so they inaccessible except through a servlet.
One more thing, even when going to a servlet, if you are doing a GET, the parameters will still be visible in the URL. You can avoid that by always using POST, but you will get differing opinions on whether it's correct to use POST when you aren't posting data.
I'm curious why this is a requirement. If it's in the name of security by obscurity, it won't work. Anyone with Firebug or Fiddler will still be able to see all the information that you are trying to hide from the URL.
"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." -- Ted Nelson
In this case the users URL in the browser will still just display "http://yourdomain.com/NewsHeadlines". The path to, and name of the page is completely hidden. But if the user tries to be clever and type the URL "http://yourdomain.com/WEB-INF/jsps/headlines.jsp" they will get an error because the browser cannot access anything under the WEB-INF folder. It's off limits to the browser. It only works when the servlet forwards the jsp (actually the generated html) to the browser.