• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Ricky Jay
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Set it up as the welcome file in the deployment descriptor.
 
Ricky Jay
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic