Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6226893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:06:59+00:00 2026-05-24T09:06:59+00:00

I have a Java application running on Tomcat 7. I want my application to

  • 0

I have a Java application running on Tomcat 7. I want my application to have it’s name in the URL. For example:

http://localhost:8080/MyApp

I build the WAR, deploy, and the application is accessed correctly. However, all of my <a> and <form> tags don’t add the application name to the URLs. That is, doing something like:

<a href="/myPage">Click Me</a>

does not work. The link ends up like this:

http://localhost:8080/myPage

instead of

http://localhost:8080/MyApp/myPage

Is there any way to configure Tomcat to add the application name onto links, etc? As mentioned, I don’t want strip the application name off of the URL (i.e. making it the root). I know there are some work arounds (like manually adding the context path onto the URL, using <c:url>, etc. But I am wondering if Tomcat can be told to do this. I figure this is the place to ask, since the request isn’t getting to my application. If it matters, I am using Spring MVC and Maven.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T09:07:01+00:00Added an answer on May 24, 2026 at 9:07 am

    I know there are some work arounds (like manually adding the context path onto the URL, using <c:url>, etc.

    Those are not workarounds. Those are solutions. You just made a mistake of always assuming that the webapp runs on the domain root. Easiest solution -imo- is using the HTML <base>. See also here.

    But I am wondering if Tomcat can be told to do this. I figure this is the place to ask, since the request isn’t getting to my application.

    No. It’s not servletcontainer’s responsibility. Neither JspServlet nor DefaultServlet do this. It’s the webapp’s own responsibility (and the serveradmin’s as far as applicable).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Java web application running on Tomcat. I want to load static
There is a Java Struts application running on Tomcat, that have some memory errors.
I have a web application running on Tomcat 6 and a Java-programmed client application.
I have a java web application running under tomcat in a Sun java 6
I have a java web application that I'm running with tomcat. This application has
I have a new tomcat application server running on tomcat 6, java 6 (openjdk),
I have an Java application running in JBoss in which I have enabled JMX
I have a distributed Java application running on 5 application servers. The servers all
We have a java application ( Atlassian Bamboo) running on port 8085 on Windows
We have an issue related to a Java application running under a (rather old)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.