• Post Reply Bookmark Topic Watch Topic
  • New Topic

Accessing Servlet init Parameter by Expression language  RSS feed

 
Arun chauhan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 171
Flex Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think using pageContext implicit EL object:
But could not figure out how?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65768
131
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think using pageContext implicit EL object:
But could not figure out how?


Nope . this will not work. Refer this
 
Bindu Lakhanpal
Ranch Hand
Posts: 171
Flex Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, i got that before your posting.And edited my message.
Sorry for mistake
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65768
131
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please check before posting. You can waste a lot of people's time posting incorrect answers.
 
Bindu Lakhanpal
Ranch Hand
Posts: 171
Flex Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes,Offcourse sir .
Got my lesson today.
Thanks for correcting me.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65768
131
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No problem. After all, we are all here to learn!
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 171
Flex Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got It.
Thanks Bear
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!