Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EL and context-param???

 
Ner min
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

http://www.coderanch.com/t/168431/java-Web-Component-SCWCD/certification/EL-retrieving-init-param-servlet

Thanks.
Esam

SCJP 1.4, SCWCD 1.4, SCBCD (in progress...just starting)
 
Ner min
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic