• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: https://coderanch.com/t/366261/Servlets/java/Calling-servlet-page-load

Thank you.
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic