"Rauschuber, Chris" wrote:
> 
> Hi,
> 
> I've read lots of FAQs and emails about sending init-params to servlets, but
> can that be done with a JSP?  I've tried setting up my application's web.xml
> to use:
> <servlet>
>         <servlet-name>
>                 jsp
>         </servlet-name>
>         <servlet-class>
>                 org.apache.jasper.runtime.JspServlet
>       </servlet-class>
>         <init-param>
>                 <param-name>
>                         configFile
>                 </param-name>
>                 <param-value>
>                         /some-directory/file.config
>                 </param-value>
>         </init-param>
> </servlet>
> 
> And different combinations, but I either get an error from Tomcat about
> duplicate servlet declarations or I just don't see any InitParameters passed
> to the JSP.  I tried to use getInitParameterNames() to see what was
> available.  I got nothing = (
> 
Have your tryed putting your params in the context?

---------snip--------------
<web-app>

    <!-- MySQL host -->
    <context-param>
       <param-name>dbhost</param-name>
       <param-value>localhost</param-value>
    </context-param>

    <!-- MySQL database -->
    <context-param>
       <param-name>dbname</param-name>
       <param-value>blah</param-value>
    </context-param>

    <!-- more stuff here -->
</web-app>
--------/snip--------------

These are in the context (the overall application), instead of a
particular servlet. You can access them via the getInitParameter()
method of the context...

Hope that helps,

Brian
[EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to