Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet as a welcome file

 
Nidhi Sar
Ranch Hand
Posts: 252
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can a <welcome-file> be a servlet?

I tried it, but it didn't seem to work. Here is the relevant portion of the web.xml:
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65227
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to use the mapped URL not the servlet name.
 
Nidhi Sar
Ranch Hand
Posts: 252
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:You need to use the mapped URL not the servlet name.


Hi Bear, do you mean the part that goes within the <url-pattern> tags?

I did change my web.xml to that (& restarted tomcat) but same result.

New DD:
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65227
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What version of Servlets?
 
Nidhi Sar
Ranch Hand
Posts: 252
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:What version of Servlets?


I have Tomcat 6.0 & according to the documentation, that implements Servlet 2.5 and JavaServer Pages 2.1
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2448
96
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nidhi,

You should be able to define a Servlet as welcome file.

remove the "/" from
<welcome-file>/show.do</welcome-file>


and try again.

Regards,
Frits
 
Nidhi Sar
Ranch Hand
Posts: 252
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Frits,

Yes your suggestion did work. I should have remembered that unlike url-pattern & error-page location, welcome files do not start with a forward slash.

Thanks so much,
Nidhi
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic