• 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

welcome file in web.xml

 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys servlet beginner needs help..

I am having doubts in how to configure the web.xml file in eclipse juno.
What i am trying to do is create a servlet that takes in a users name through an html file and print the message "welcome" followed by name.

Now I have created a servlet that takes the input from the html file through getParameter and displays the correct output..i run it by right clicking on the html file and then clicking on the run on server option.
The html file i have named as welcome.html.

in web.xml , the url pattern is /TestApp and the welcome-file i have set to welcome.html so i am expecting when i right click on servlet and use run on server the welcome.html to be displayed first..but welcome null is displayed..which means that the servlet takes control directly please help..



So what i am expecting to happen when i right click on the servlet is to take me to the html file which asks the user for input but instead i am taken to the TestApp directly and it displays Welcome null..




the servlet is as below :


 
Ranch Hand
Posts: 138
Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Right click on the project and run on server...don't select any spcific resource (servlet, JSP etc) in your web app.

Welcome file will be detected and executed.
 
Ranch Hand
Posts: 672
4
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Right click on your project and select run on server. You should see welcome.html, in case you have configured welcome-file-list properly in web.xml.

When you right click on servlet and choose run on server, how do you expect it to present you welcome.html? How come the servlet will know, from where it will get the request? It just invokes the servlet directly..
 
sinatra roger
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you guys I think i saw somebody right click on the servlet source code and get the welcome.html file..that was what i was trying to do till now..thanks for your help..
reply
    Bookmark Topic Watch Topic
  • New Topic