tags:

views:

30

answers:

1

I am using JSTL c:url tag to define my URL's in the application, something like:

<c:url value"/home" />

But the problem is that it appends the application context to the url, so the link becomes http://appName.come/appName/page while it should be http://appName.come/page.

The link had to be with slash, because it's not relative. I want to prevent the application context from being added or something like that, any ideas?

+1  A: 

That's just the sole purpose of c:url: adding the context root and if necessary jsessionid whenever client doesn't support cookies. It also has support for URL-encoding the query parameters by c:param. If you don't want to have that, then just don't use c:url but use a plain HTML <a> element instead.

<a href="/home">home</a>

Update: as per the comment you seem to want to have the jsessionid in the URL (do you realize that the sessions are by default not shared between contexts and that you have to configure the serletcontainer accordingly?). In that case, manually set the context attribute.

<c:url context="/" value="/home" />
BalusC
the problem is that i have to use the c:url coz of the jsessionid issue
sword101
See updated answer.
BalusC