• Post Reply Bookmark Topic Watch Topic
  • New Topic

EL- getting JSP Init Param  RSS feed

 
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rancher

In EL, We have initParam implicit object for getting context init params. How can we get JSP init params using EL.

Thanks
 
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are you calling JSP init params ?
 
Amirr Rafique
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We can define init-params for a jsp page using following


Can we access these params using EL
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. These are called servlet init parameters. You're pointing to a JSP page, but it's still a servlet, so you can access them like any other servlet init params.
 
Ranch Hand
Posts: 329
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, but how about achieving it without using scripting at all (EL + JSTL)?

The only thing I can think of doing is to use ${pageContext.servletConfig.initParameterNames} to retrieve a java.util.Enumeration object containing the servlet's init parameters' names. And then what? How would you call pageContext.getServletConfig().getInitParameter(java.lang.String name) without using scripting?

Or is it not possible?
[ March 23, 2007: Message edited by: Sergio Tridente ]
 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anybody have any definite answer on above mentioned problem?

What I can think write now is to write an EL Function which takes config and parameter name as input and returns the value.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was a bit quick one that one, sorry
That's right, you can't access them directly.

http://faq.javaranch.com/view?InitParamsThruExpressionLanguage
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!