Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how can a jsp get servlet init parameter  RSS feed

 
harish goyal
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how can a jsp get servlet init parameter
if we have given init parameter to servlet .
how jsp will get?
please make it clear
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The <servlet... entry in web.xml requires either a "servlet-class" element or a "jsp-file" element. If you use "jsp-file", you will be able to configure your jsp the same way you set up a servlet - including setting up init-params.
 
abhilash reddy
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
does it mean he can simply access using
getServletConfig.getInitParameter("var");
please do clarify
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

does it mean he can simply access using
getServletConfig.getInitParameter("var");
please do clarify




JSP provides the "config" implicit object variable that eliminates the need to call getServletConfig().

To answer you question:
Try it.
Coding a small test app will take less time than waiting for a response on a user forum.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!