...">

How to change URl request 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 my app http: // localhost: 8080 / JSPAPP / index.jsp using it works fine But i changed this url to http: // localhost: 8080 / MyFirstApp / index.jsp i.e. i need to change JSPAPP to MyFirstApp, how will i change tell me.

+3


source to share


1 answer


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



2) if you are deploying your application to a server (like tomcat) rename your war file to the context you want.

+1


source







All Articles