• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

welcome file in web.xml

 
ankur trapasiya
Ranch Hand
Posts: 160
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Here i have only one servlet in my project and i want to set it as home page. Is is possible ?? I tried all the options in <welcome-file> tag. It simply not working...

please help...
 
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
ItDoesntWorkIsUseless

What is happening?
 
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
And, sigh, what's with the .do? It's completely unnecessary and extraneous.
 
Ivan Pig
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It should work,but when it works,it'll go to /Index.do,then invoke the servlet basics.Index.....
You can change the /Index.to to any normal page...
 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@OP
Remove the .do and try use the jsp/html page. I dont know what a .do is doing there.
If you want to redirect it to your servlet, then write a page redirect in index.html and use that as welcome file. Simple!
 
Malatesh Karabisti
Ranch Hand
Posts: 153
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In welcome file list you can have any thing either static html or Jsp/Servlet. Post exactly what is happening. Is your complete servelt path url is working fine ?
 
ankur trapasiya
Ranch Hand
Posts: 160
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It works if i use full path ... e.g. http://localhost:8080/ServletsBasics/Index/
but i want it as my welcome page.... by default the page that is opened is http://localhost:8080/ServletsBasics/

And i am not using any HTML or JSP pages. I just want to know if it is possible to make servlet as a start page ot not....

 
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
Yes, it is, as of Servlets 2.4.
 
ankur trapasiya
Ranch Hand
Posts: 160
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then what changes do i have to made in web.xml ??

i tried

1) <welcome-file>/Index</welcome-file>
</welcome-file-list>

2) <welcome-file>basics.Index</welcome-file>
</welcome-file-list>

Both of this settings are not changing my homepage to Index servlet...
 
ankur trapasiya
Ranch Hand
Posts: 160
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ankur trapasiya wrote:Then what changes do i have to made in web.xml ??

i tried

1) <welcome-file>/Index</welcome-file>
</welcome-file-list>

2) <welcome-file>basics.Index</welcome-file>
</welcome-file-list>

Both of this settings are not changing my homepage to Index servlet...


tried third one
<welcome-file>Index</welcome-file>
</welcome-file-list>

it works perfectly...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic