1

I have a created an struts2 tags url. something like this.

<s:url action="login" var="login_url">
</s:url>

Upon Seeing the generated HTML. it gave me this

<a href="/MyProjectName/login">login</a>

Which is something I Do not like. I all I want to see is this

<a href="login">login</a>

It is currently giving me the full project name. is there a way I can prevent this when using struts2

user962206
  • 15,637
  • 61
  • 177
  • 270

2 Answers2

2

Your application is deployed in that context. You need it to get the url to work. If the context is not present you will get 404 errors. You should deploy your application as a ROOT application to not show that context

tom
  • 2,735
  • 21
  • 35
1

Try to set the attribute includeContext to false so that

<s:url action="login" var="login_url" includeContext="false">
</s:url>

For more reference, check this

lmcanavals
  • 2,339
  • 1
  • 24
  • 35
Quincy
  • 4,393
  • 3
  • 26
  • 40
  • I tried your suggestion but upon clicking the link it gave me a 404 the url went something like this. http://localhost:8090/login . is there anyway to remove the extra / ? on the generated url – user962206 Jan 21 '13 at 07:41
  • There's still an extra slash in the before the url after I've set the includeContext="false" is there anyway I can remove it? – user962206 Jan 21 '13 at 14:01