aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes question on implicit objects in EL? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "question on implicit objects in EL?" Watch "question on implicit objects in EL?" New topic
Author

question on implicit objects in EL?

Jingh Yi
Ranch Hand

Joined: Mar 23, 2005
Posts: 90
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??
Sergey Tyulkin
Ranch Hand

Joined: May 10, 2005
Posts: 87
there's implicit object initParam for this.
Paolo Metafune
Ranch Hand

Joined: Aug 22, 2005
Posts: 34
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.
David Ulicny
Ranch Hand

Joined: Aug 04, 2004
Posts: 724
Where I can specify JSP init parameters?


SCJP<br />SCWCD <br />ICSD(286)<br />MCP 70-216
Sergey Tyulkin
Ranch Hand

Joined: May 10, 2005
Posts: 87
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

Joined: Aug 22, 2005
Posts: 34
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

Joined: Aug 04, 2004
Posts: 724
Thanks Paolo.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: question on implicit objects in EL?