Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCPJWCD
Search Coderanch
Advance search
Google search
Register / Login
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
Devaka Cooray
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Jeanne Boyarsky
Tim Cooke
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Tim Moores
Mikalai Zaikin
Carey Brown
Bartenders:
Forum:
Web Component Certification (OCEJWCD)
Access application context using EL
Ramprasad Subburaman
Greenhorn
Posts: 19
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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.
Ashley Bideau
Ranch Hand
Posts: 40
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
You can use EL implicit object "initParam" to retrieve the value like this in
jsp
${initParam.email}
-Ashley
janne jounivich
Ranch Hand
Posts: 45
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Thanks for your replies.
Actually, I had a problem with EL.
when u have <%@page isELIgnored="false"%> then u can't use
<c: out value="${initParam.email}"/>
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
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Mr Ram your observation is not RIGHT !!!
Try below code and let me know what you see in your browser.
<%@ page isELIgnored="false"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <html> <body> Application Email : <c: out value="${initParam.email}" /> </body> </html>
In your web.xml file
<context-param> <param-name>email</param-name> <param-value>ashley@yahoo.com</param-value> </context-param>
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
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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 ]
If you send is by car it's a shipment, but if by ship it's cargo. This tiny ad told me:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Scriptless JSP and config param
initParam for EL not working
Doubt in ServletContextListener
JSF Facelets deployment problem
Where i cud put contex-param
More...