This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Servlets and the fly likes web.xml - What is this and can i remove this? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "web.xml - What is this and can i remove this?" Watch "web.xml - What is this and can i remove this?" New topic
Author

web.xml - What is this and can i remove this?

tangara goh
Ranch Hand

Joined: Dec 27, 2009
Posts: 125
Dear Experts,

My web hosting company has asked me to remove this web.xml welcome tag file inside; without telling me how to do it.

I have opened up my application to find this.

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

What happen could be I have named my index as index.html instead of .jsp.

Hence, I hope the experts here can advise me can I remove this welcome-file-list altogether ?

Really very lost and looking forward to some kind of assitance......This web hosting company is taking its own sweet time to reply me.....and it's been 2 weeks already and my website still not functioning, even though it can work at my desktop

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14195
    
  20

The welcome file list is a list of page names that the server tries out if you go to the address of the web app without specifying a page name explicitly. For example, if you type in http://localhost:8080/myapp/ in the address bar, it will try http://localhost:8080/myapp/index.jsp with the settings in your file. You can specify multiple pages to try:

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>

It will then first try index.jsp, if that doesn't exist it will try index.html.

If you remove the whole welcome-file-list, it will try some default settings (probably index.html).

Instead of removing it, you should put the name of the start page of your application in the list.

By the way: Try searching with Google for "web.xml welcome-file-list". Here is a good explanation.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
tangara goh
Ranch Hand

Joined: Dec 27, 2009
Posts: 125
Jesper Young wrote:The welcome file list is a list of page names that the server tries out if you go to the address of the web app without specifying a page name explicitly. For example, if you type in http://localhost:8080/myapp/ in the address bar, it will try http://localhost:8080/myapp/index.jsp with the settings in your file. You can specify multiple pages to try:

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>

It will then first try index.jsp, if that doesn't exist it will try index.html.

If you remove the whole welcome-file-list, it will try some default settings (probably index.html).

Instead of removing it, you should put the name of the start page of your application in the list.

By the way: Try searching with Google for "web.xml welcome-file-list". Here is a good explanation.


Thank you Jesper...this is a very clear explanation!

Now, why is it that when I type the url of my website, the file will have www.name.com/webapplication1 appear ? webapplication1 is the name of my project in my netbean IDE. What must I do in order to have just www.name.com appear only?

My web hosting company, even though I have asked them 2 times already, till now havn't give me the answer for that..so I'm hoping the experts here will advise me. Thanks alot.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Servlet containers can run multiple applications.

In order to have your application show up when the user types http://www.yourdomaind.com, you need to make your application the root or default app.
How you do this depends on the container and how your hosting company has things configured.

Depending on the configuration at the hosting company, it might not be possible to have your root app show up this way.
Most companies have the servlet container running behind the Apache Web Server and give all of their clients the same configuration.

If they're taking to weeks to respond to your questions, maybe you might want to consider a different hosting company.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
GeeCON Prague 2014
 
subject: web.xml - What is this and can i remove this?