Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

welcome file in web.xml

 
thejwal pavithran
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • 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 :


 
Prajakta Acharya
Ranch Hand
Posts: 138
Java Spring
  • Mark post as helpful
  • send pies
  • 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.
 
Prasad Krishnegowda
Ranch Hand
Posts: 667
4
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • 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..
 
thejwal pavithran
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • 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..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic