Question

Here's a sample link from my jsp:

<a href="/admin/articleEdit">New Article</a>

My application will be deployed with no context root so such links will work in production. But locally, this fails because the link does not contain the context root. I've tried to start links with "./" but that does not always solve related issues.

Is there a way to locally test java application using Eclipse and Eclipse-embedded Tomcat server with no context root? Eclipse does not let me remove context root from the project. I've tried setting context root to "/" but that does not help.

Was it helpful?

Solution

  1. Double click on your Tomcat instance in the Servers list to edit it.
  2. Select the Modules tab on the bottom.
  3. Highlight your webapp and click the Edit button.
  4. Keep document base as is, set path to blank.
  5. Confirm with OK.
  6. Make sure the webapp is published and (re)start the server.

OTHER TIPS

Instead of changing the context root, fix your jsp hrefs. See the answers to this question: Any clever ways of handling the context in a web app?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top