my dog learned polymorphism*
The moose likes JSP and the fly likes Reading the web.xml file from a JSP... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Reading the web.xml file from a JSP..." Watch "Reading the web.xml file from a JSP..." New topic
Author

Reading the web.xml file from a JSP...

Gabriel Fox
Ranch Hand

Joined: Oct 17, 2001
Posts: 170
Hello guys, how do i read an init parameter in a web.xml from a JSP page . All ideas are welcome.
I know to do it from a servlet :
getServletContext().getInitParameter("paramName");
All idea are welcomed....
arul murug
Greenhorn

Joined: Aug 08, 2002
Posts: 24
You can use the same way as
getServletContext().getInitParameter("paramName") after all JSPs are converted to servlets.
or more aptly you can use
application.getInitParameter( "parameterName" );


SCJP2<br />SCWCD<br />UML & OOAD - IBM 486
Gabriel Fox
Ranch Hand

Joined: Oct 17, 2001
Posts: 170
Thanks, i was just trying to over complicate the solution.
Srini Gogineni
Greenhorn

Joined: May 19, 2003
Posts: 7
Originally posted by Gabriel Fox:
Hello guys, how do i read an init parameter in a web.xml from a JSP page . All ideas are welcome.
I know to do it from a servlet :
getServletContext().getInitParameter("paramName");
All idea are welcomed....

hi,
define the init param in web.xml(in approot/WEB-INF) as
<context-param>
<param-name>CompanyName</param-name>
<param-value>Temasek Poly</param-value>
</context-param>
access using String value = getServletContext().getInitParameter("CompanyName");
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reading the web.xml file from a JSP...
 
Similar Threads
Struts Action Forword
servlet mapping
run-as for all the jsp/servlets in the web-app
Help: HTML -> SERVLET -> JSP
Unable to run JSP pages