I don't know what you mean by a "pattern", but in any case neither of them is the best approach (note that your first approach puts too many slashes between the host and path parts, for example). Here's the best approach:
Joined: Aug 29, 2009
Hi Paul, Thanks for your suggestion.
I don't know what you mean by a "pattern"
I was actually referring to using Message Formatter (java.text) for this.
I have one problem with your suggestion. The code you mentioned above will be effective if it runs only a few times. But in my case, it runs more than 100 times per minute; and when each time the code runs, it generates different jsp names (This is more of a business logic - so do not worry about why different names for a jsp ).
So, creating URL object for each jsp name does not seems to be a better approach. Please let me know if you have any other thought?