• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

question on implicit objects in EL?

 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you ever notice that there is no EL implicit object equivalent to 'config' implicit object in jsp? so how does EL get the JSP init parameters??
 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
there's implicit object initParam for this.
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sergey, i think your answer isn't correct.
In jsp we have the "config" implicit object that implements javax.servlet.ServletConfig and so permits to retrieve servlet configuration parameters and not context parameters.

In EL we have initParam implicit object that, as JSP specification says, is a Map that maps context initialization parameter names to their string parameter values (obtained by calling ServletContext.getInitParameter(String name)). So it retrieves context and not servlet parameters.


Let me know your opinion.
 
Ranch Hand
Posts: 724
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where I can specify JSP init parameters?
 
Sergey Tyulkin
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah, you're right. I get the question wrong. initParam implicit object is used to get ServletContext's init parameters, not servlets.
We can get ServletConfig by ${pageContext.servletConfig} but there is no way to get init parameter from ServletConfig, as we can't get method getInitParameter(String name) from EL expression.
I must say, that i would also like to see the approach for getting JSP init parameters.
 
Paolo Metafune
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
David,
you can specify jsp init parameter in web.xml like this:

<servlet>
<servlet-name>MyServlet</servlet-name>
<jsp-file>/MyJSPFile.jsp</jsp-file>
<init-param>
<param-name>parName</param-name>
<param-value>parValue</param-value>
</init-param>
</servlet>

you can also define a mapping as you normally do for servlets(i mean using the same configuration tags)
[ September 01, 2005: Message edited by: Paolo Metafune ]
 
David Ulicny
Ranch Hand
Posts: 724
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Paolo.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic