• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

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: 67750
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.
 
If a regular clown is funny, then a larger clown would be funnier. Math. Verified by this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic