File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes EL and context-param??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "EL and context-param???" Watch "EL and context-param???" New topic

EL and context-param???

Ner min
Ranch Hand

Joined: Sep 14, 2005
Posts: 76
when i try to access my context-param with scriplets is no problem
but with EL doesnt work

so hlet say that i have context-param ant init-param
how would i get both?
i found this definition

initParam - a java.util.Map that maps context initialization parameter names to their String parameter value (obtained by calling ServletContext.getInitParameter(String name)).

but how to do
getServletConfig().getInitParameter(String name) in EL?

can anyone help?

[ September 22, 2005: Message edited by: Ner min ]
[ September 22, 2005: Message edited by: Ner min ]
Esam Ahmed
Ranch Hand

Joined: Aug 10, 2005
Posts: 101
Hi Ner,

Make sure you understand the EL implicit objects.
There is no implicit object to get the servlet init param.

pageContext is the only object that you can use to get other associated info...

Except for pageContext, other implicit objects are Maps...

See if you can find any solution in this link...
You have to go through the pageContext.....but...."servlet init param" is old school as the author mentioned...

Look at the last comment made by Kathy Sierra.


SCJP 1.4, SCWCD 1.4, SCBCD (in progress...just starting)

Esam<br />SCJP 1.4, SCWCD 1.4
Ner min
Ranch Hand

Joined: Sep 14, 2005
Posts: 76
tnx Esam,
that was usefull, so there is no way to get that init-param in EL, even if u use pageContext. The only way is ,as far i understud to get that init-param thruogh some scriplet/servlet and put it in some scope-attribute and then get it with EL with getAttribute.
But as Kathy suggest we schultnt use init-param at all in our apps, as this is old school.

well, thats good neww, one thing less to worry about - except it pops up in exam

hmm one thing more, is there any full EL-referenz where one could see all stuff which is inside pageContext, couse in j2ee api is nothing about EL?
[ September 22, 2005: Message edited by: Ner min ]
I agree. Here's the link:
subject: EL and context-param???
jQuery in Action, 3rd edition