• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Access application context using EL

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have declared an application context parameter as below in web.xml

<web-app>
<context-param>
<param-name>email</param-name>
<param-value>sramprasad@gmail.com</param-value>
</context-param>
</web-app>

I am able to access the param and print using

<%=application.getInitParameter("email")%>

In the same lines, can anyone tell me how to access and print using EL.
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use EL implicit object "initParam" to retrieve the value like this in jsp



-Ashley
 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
or you can use also
the following kind of EL
syntax ..

${initParam["email"]} or
${initParam['email']}

JR
[ May 10, 2006: Message edited by: janne RockGulf ]
 
Ramprasad Subburaman
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your replies.

Actually, I had a problem with EL.

when u have <%@page isELIgnored="false"%> then u can't use



You will get an error "attribute value does not accept any expressions"


Hope the above observation is usefull to all.
[ May 11, 2006: Message edited by: Ramprasad Subburaman ]
 
Ashley Bideau
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mr Ram your observation is not RIGHT !!!
Try below code and let me know what you see in your browser.




In your web.xml file



P:S I have to give "space" between "<c: out" tag otherwise you will see some nice image . So remove the same in your jsp.

-Ashley
SCJP 5.0
[ May 11, 2006: Message edited by: Ashley Bideau ]
 
Ramprasad Subburaman
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ashley.
Yesterday, I made a mistake in the <c: out> tag.

Thank you for correcting me.


Ramprasad
[ May 11, 2006: Message edited by: Ramprasad Subburaman ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic