• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

URLrewriting

 
A Kumar
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
For servlets...we have encodeURL for url rewriting...in case cookies are disbled at client side...

But how to do the same if only jsp's are involved...


Regards
 
Darren Edwards
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming you have JSTL available within your JSP


Be aware that it will not encode GET parameters in the same way encodeURL does - you have to do the following
 
A Kumar
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Darren,

Thanks for the response....
I wanted to know about the pre-JSTL days..How they used to do it?

Regards
 
ramprasad madathil
Ranch Hand
Posts: 489
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I wanted to know about the pre-JSTL days..How they used to do it?


You could very easily write a custom tag. Or else write in a scriptlet, the exact code that you would, if it were a Servlet (though it would undoubtedly clutter your jsp code)

ram.
 
A Kumar
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So the solution...was ....

writing the same code that would be there in servlet ...as in a scriptlet section of a jsp...

Is it so???
 
Stefan Evans
Bartender
Posts: 1691
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could do it with scriptlet expression
<a href="<%= response.encodeURL("/user/save.jsp") %>"> Save </a>

No it doesn't look nice. And people often forgot to do it.
Hence custom tags which take care of it for you ;-)
 
A Kumar
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Stefan!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic