• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ServletConfig for JSP-converted servlet

 
Anand Wadhwani
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,

I am not able to fetch servlet config init parameters for my JSP's servlet.

Here is my DD entry for my JSP's servlet:



and here is my test JSP:



The following output of JSP comes in browser when I try to access it:

---------------------------------------------------------
Config Params:
lsInitParamName = [fork] lsInitParamvalue = [false]
lsInitParamName = [xpoweredBy] lsInitParamvalue = [false]
---------------------------------------------------------

I am using Tomcat 5.0 and above two parameters 'fork' / 'xpoweredBy' are being set automatically by tomcat!!

Could anyone please see where / what I am doing wrong to get init parameters? What do I need to fetch init parameters that I have specified in the DD for my JSP?

Thanks!
[ May 08, 2005: Message edited by: Anand Wadhwani ]
 
Anand Wadhwani
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just figured this out, I need to define servlet-mapping for my JSP, then only servlet config gets instantiated with the init parameters secified in web.xml.

Anyone pls describe why is this behavior? Is the servlet-mapping mandatory for each servlet in my application? For JSPs if I dont define servlet-mapping they work perfectly until I need to define init parameters for my JSP. Is this how it is supposed to be or is it tomcat bug! ?
[ May 08, 2005: Message edited by: Anand Wadhwani ]
 
shiva viswanathan
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
do you mean servlet mapping for your servlet

In case of servlets , servlet mapping is mandatory since only
using the url specified in the servlet mapping an external client can access the servlet

In short , for every servlet tag in web.xml , you need to have
servlet mapping
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic