• Post Reply Bookmark Topic Watch Topic
  • New Topic

Accessing ServletConfig Initialization parameters

 
Mahtab Alam
Ranch Hand
Posts: 391
1
Java MySQL Database PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying a simple program to access ServletConfig initialization parameter in a jsp.

But I am not clear how its working.
This is web.xml



And This is Jsp , In which I am accessing init parameter


Now If I hit /Allen it sets init parameter for both servlet MyServlet and jsp JjspInit. I don`t have any servlet all I have is a web.xml and a jsp page.
But accessing JjspInit.jsp directly gives null.

How hiting the url /Allen prints valu. This code is on JjspInit.jsp .
So does that mean that in web.xml I have registered this jsp as the target for /Allen.
And one more question directly accessing the jsp page shows null it means init parameter haven`t been set.
 
Anindya Roy
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As you have specified /Allen is the url pattern for jsp file so hitting the /Allen url you will get the result
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!