Research Development
Research Development

Reputation: 904

how to change request URl in Jsp or Servlet

index.jsp

 <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body>
    <%="This is First App" %> 
    </body>
    </html>

web.xml file :

 <display-name>JSPAPP</display-name>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
</web-app>

when i run the app http://localhost:8080/JSPAPP/index.jsp using its work fine But i have change this URL to http://localhost:8080/MyFirstApp/index.jsp i.e i have to change JSPAPP to MyFirstApp how i will change please tell me .

Upvotes: 3

Views: 2855

Answers (1)

KDP
KDP

Reputation: 1481

1) if you are using eclipse to run the application then change the context root from the project "Properties --> Web Project Settings --> Context Root".

2) if you are deploying your app to a server (say tomcat)rename your war file to the context root you desire.

Upvotes: 1

Related Questions