File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes tweak a url Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "tweak a url" Watch "tweak a url" New topic

tweak a url

Andy Hahn
Ranch Hand

Joined: Aug 31, 2004
Posts: 225
Is it possible to tweak a url from within a jsp? My goal is to create a custom URL to display to the user. I didn't see any methods on the HttpServletResponse to do this. I think it is kindof what a servlet filter would do but I am not sure. Thanks!
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63844

I guess that depends upon what you mean by "tweak a URL"?

[Asking smart questions] [About Bear] [Books by Bear]
Andy Hahn
Ranch Hand

Joined: Aug 31, 2004
Posts: 225
By tweak I mean modify, such as append ?id=123 onto the end of the url that will be displayed.
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

It's very common to build URLs up from strings within code.
Changing one would depend on where it's coming from.
Can you give us a specific example of what you want to do?

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Andy Hahn
Ranch Hand

Joined: Aug 31, 2004
Posts: 225
Ben, I wanted to actually avoid the seeing just in my struts url. I wanted to instead display the parameters as well. I ended up solving this by changing my form action to get instead of post. I can now reshape the urls using the url rewrite filter library.
I agree. Here's the link:
subject: tweak a url
It's not a secret anymore!