This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach 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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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: 9930
    
159

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....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why is getInitParameter() fetched only when i use url pattern?
 
Similar Threads
overriding jspInit() problem
Initialization Parameter in JSP
method getServletConfig() is undefined for the type TestInitParams
pre compilation of JSP file
getting initialisation parameters in JSP