| Author |
EL- getting JSP Init Param
|
Amirr Rafique
Ranch Hand
Joined: Nov 14, 2005
Posts: 324
|
|
Hi Rancher In EL, We have initParam implicit object for getting context init params. How can we get JSP init params using EL. Thanks
|
"Know where to find the solution and how to use it - that's the secret of success."
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14685
|
|
|
What are you calling JSP init params ?
|
[My Blog]
All roads lead to JavaRanch
|
 |
Amirr Rafique
Ranch Hand
Joined: Nov 14, 2005
Posts: 324
|
|
We can define init-params for a jsp page using following Can we access these params using EL
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14685
|
|
|
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.
|
 |
Sergio Tridente
Ranch Hand
Joined: Mar 22, 2007
Posts: 329
|
|
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 ]
|
SCJP 1.4 (88%) - SCJP 5.0 Upgrade (93%) - SCWCD 1.4 (97%) - SCBCD 5.0 (98%)
|
 |
Tridib Samanta
Ranch Hand
Joined: Apr 28, 2004
Posts: 128
|
|
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.
|
Thanks, Tridib
SCJP 1.4, SCWCD 1.4, SCBCD 5.0
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14685
|
|
I was a bit quick one that one, sorry That's right, you can't access them directly. http://faq.javaranch.com/view?InitParamsThruExpressionLanguage
|
 |
 |
|
|
subject: EL- getting JSP Init Param
|
|
|