This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes web application url Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "web application url" Watch "web application url" New topic
Author

web application url

siraj baig
Ranch Hand

Joined: Jul 11, 2006
Posts: 42
Hi,
I have developed a web application : "SampleWebApp"
To Access i will give : http://localhost:8080/SampleWebApp
But i want to access my application with out providing application name, as http://localhost:8080/


Please tell me, how can i configure in my web.xml




thanks,
siraj.





Ram Chhabra
Ranch Hand

Joined: Jan 07, 2008
Posts: 48
Not sure, but you can do the modifications in server.xml under conf directory. Please check it once, you can change appBase.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41068
    
  43
You'll need to move the application from the "SampleWebApp" directory to the root directory of the servlet container. If you're using Tomcat, it's the one called "ROOT".

Tomcat's "appBase" setting does something else.


Ping & DNS - my free Android networking tools app
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Thanks Ulf
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 684


Hi,

As tomcat always detect application with root name.

So, if your application deploy in tomcat with ROOT name you can access directly using http://localhost:8080/


So, deploy application with change name with ROOT.


Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
siraj baig
Ranch Hand

Joined: Jul 11, 2006
Posts: 42
Hi,

I have changed my app name to ROOT and accessed with http://localhost:8080/
But it's displaying me Tomcat Admin page.



siraj
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 684


Hi,

What i think that your application with ROOT name not deployed proper in Tomcat.

So try to deploy it proper.

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41068
    
  43
siraj baig wrote: I have changed my app name to ROOT

This sounds wrong. The ROOT directory already exists; you need to move your application components into it, and change the web.xml file accordingly.
siraj baig
Ranch Hand

Joined: Jul 11, 2006
Posts: 42
Hi,
If i want my app with the same name "SampleWebApp" Instead of ROOT, How can i achieve this





siraj
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

siraj baig wrote:
If i want my app with the same name "SampleWebApp" Instead of ROOT


anyway you are not going to trigger using application name right?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41068
    
  43
What's the significance the web app name if it isn't part of the URL?
siraj baig
Ranch Hand

Joined: Jul 11, 2006
Posts: 42
Hi,

Yes, there is no significance of application name, but i would like to know can we do this way also



siraj
Vinoth Thirunavukarasu
Ranch Hand

Joined: Dec 18, 2008
Posts: 164

Its so simple
The only thing is we have to set context path in your Tomcat/conf/server.xml

<Context path=""
docBase="/SimpleWebApps"
reloadable="true" >
</Context>


Java Best Practices
Linux Best Practices
Amortization Calculator

karthick Soundararaj
Greenhorn

Joined: Mar 09, 2009
Posts: 26
Vinoth Thirunavukarasu wrote:Its so simple
The only thing is we have to set context path in your Tomcat/conf/server.xml

<Context path=""
docBase="/SimpleWebApps"
reloadable="true" >
</Context>




where exactly should this be added? i added it in server.xml but it doesnt work.. I get the default page instead..


A java addict
 
jQuery in Action, 2nd edition
 
subject: web application url
 
Similar Threads
Doubt about WEB-INF
Using IPAddress and localhost
How to give a name to the web Application
Deployment of web application
Url of web aplpication