• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

c url doubt

 
Joe Harry
Ranch Hand
Posts: 10113
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

Can anyone explain me with a simple example about the use of <c:url> tag?? I appreciate your help.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64721
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have a copy of the JSTL Specification? If not, you should. Link can be found in the JSP FAQ.
 
Deepan Devadasan
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi fella,

It is simple and straight forward
Say, you wanna put a link that is dependent on session ...

<a href="<c:url value='/myapp/mysesPage.jsp' />">CLICK HERE </a>

This is same as cumbersome response.encodeURL("/myapp/mysesPage.jsp"); in servlets

What this really does is..if the client is cookie disabled, the ;jsessionid=sdlkfsd32423rewfhcjd will be appended to the actual URL...

this ID will be identified by the container in a vendor specific manner to track the session ID..

hope this helps
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64721
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To help keep the markup cleaner, I will frequently not embed <c:url> in an anchor tag. Rather, I'll do something along the lines of the following:



Which makes the HTML <a> tag easier to read. (Tags within tags just look so funky).
[ February 03, 2007: Message edited by: Bear Bibeault ]
 
Joe Harry
Ranch Hand
Posts: 10113
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Theepan and Bear,

Thanks for your explanations!
 
Deepan Devadasan
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are welcome
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic