This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes JSP and the fly likes why is getInitParameter() fetched only when i use url pattern? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "why is getInitParameter() fetched only when i use url pattern?" Watch "why is getInitParameter() fetched only when i use url pattern?" New topic
Author

why is getInitParameter() fetched only when i use url pattern?

Sourabh Bawage
Ranch Hand

Joined: Sep 03, 2013
Posts: 33

web.xml


index.jsp



http://localhost:6060/SCWCDApp/index.jsp

Output:



http://localhost:6060/SCWCDApp/myJsp

Output:


I dint understand why the init parameters were not fetched when i directly called the JSP??


SCJP
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10142
    
165

Sourabh Bawage wrote:web.xml





As you see, it's a servlet specific initialization param. So unless that servlet gets invoked that initialization param isn't relevant. Directly calling the JSP will not go through that servlet.

Are you sure you wanted it to be a servlet specific initialization param and not a web application level context param?


[My Blog] [JavaRanch Journal]
Sourabh Bawage
Ranch Hand

Joined: Sep 03, 2013
Posts: 33


As you see, it's a servlet specific initialization param. So unless that servlet gets invoked that initialization param isn't relevant. Directly calling the JSP will not go through that servlet.


Hi Jaikiran,
I believe that 1 servlet is created by the container for the JSP, so whenever i call this JSP that particular servlet will be invoked......
so even if i call using the file name (index.jsp) or the url pattern, the SAME servlet will be invoked...

I dont get what difference is it making internally....??
Kindly help....
 
GeeCON Prague 2014
 
subject: why is getInitParameter() fetched only when i use url pattern?