aspose file tools*
The moose likes Servlets and the fly likes How to set Servlet as welcome-file...or to load instead of index.jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to set Servlet as welcome-file...or to load instead of index.jsp" Watch "How to set Servlet as welcome-file...or to load instead of index.jsp" New topic
Author

How to set Servlet as welcome-file...or to load instead of index.jsp

Ricky Jay
Ranch Hand

Joined: Feb 12, 2010
Posts: 62
I've set up my servlet "LoadIndex" to get my data from my database put them as objects into an arraylist and sending those to my index.jsp.

I can't figure out how to set my servlet to load/kick off when you browse to my site.

REF: http://www.coderanch.com/t/366261/Servlets/java/Calling-servlet-page-load

Thank you.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

Set it up as the welcome file in the deployment descriptor.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ricky Jay
Ranch Hand

Joined: Feb 12, 2010
Posts: 62
Am I doing this correctly? I'm getting a 404 error when i try to run the project with netbeans.

Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 650
I can't see anything wrong with your web.xml file. Are you getting any errors when you deploy the application? Have a look through the log file of your application server.

What happens if you browse to the servlet, rather than just the root of the web application?
Can you share the URL you're using to access the application?
Ricky Jay
Ranch Hand

Joined: Feb 12, 2010
Posts: 62
<welcome-file-list>
<welcome-file>/LoadIndex</welcome-file>
</welcome-file-list>


removed the "/"

<welcome-file-list>
<welcome-file>LoadIndex</welcome-file>
</welcome-file-list>

works.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to set Servlet as welcome-file...or to load instead of index.jsp