| Author |
Accessing Servlet init Parameter by Expression language
|
Arun chauhan
Greenhorn
Joined: Oct 01, 2009
Posts: 2
|
|
there is no implicit object in expression language to access Servlet/Jsp init parameter.
though there is one initParam object, but it is a map of ServletContext initParameters.
how can I access Servlet/Jsp init parameter in expression language (ie. map of ServletConfig initParameters).
|
 |
Bindu Lakhanpal
Ranch Hand
Joined: Oct 17, 2008
Posts: 163
|
|
I think using pageContext implicit EL object:
But could not figure out how?
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56207
|
|
Bindu Lakhanpal wrote:Using pageContext implicit EL object:
${pageContext.servletConfig().initParameter("name")}
Nope. You cannot call methods using the EL. Please don't post answers that won't work -- verify them before you post.
There is no way. If you need this information in a JSP (personally, I never have), you'll need to fetch it in the servlet controller and set is as a scoped variable on behalf of the JSP. Or, you could write a custom tag or EL function.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Balu Sadhasivam
Ranch Hand
Joined: Jan 01, 2009
Posts: 874
|
|
I think using pageContext implicit EL object:
But could not figure out how?
Nope . this will not work. Refer this
|
 |
Bindu Lakhanpal
Ranch Hand
Joined: Oct 17, 2008
Posts: 163
|
|
Yes, i got that before your posting.And edited my message.
Sorry for mistake
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56207
|
|
|
Please check before posting. You can waste a lot of people's time posting incorrect answers.
|
 |
Bindu Lakhanpal
Ranch Hand
Joined: Oct 17, 2008
Posts: 163
|
|
Yes,Offcourse sir .
Got my lesson today.
Thanks for correcting me.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56207
|
|
|
No problem. After all, we are all here to learn!
|
 |
Balu Sadhasivam
Ranch Hand
Joined: Jan 01, 2009
Posts: 874
|
|
Bear Bibeault wrote:Please check before posting. You can waste a lot of people's time posting incorrect answers.
Sure it does.
|
 |
Bindu Lakhanpal
Ranch Hand
Joined: Oct 17, 2008
Posts: 163
|
|
Yes,and i will never post while almost asleep.
Anyway,I learn a lot from you all people.
So I should have taken care.
Thanks for being here.
And i am again sorry if i wasted anyone's time.
Won't do that again.
|
 |
Arun chauhan
Greenhorn
Joined: Oct 01, 2009
Posts: 2
|
|
Got It.
Thanks Bear
|
 |
 |
|
|
subject: Accessing Servlet init Parameter by Expression language
|
|
|