Arun Thomas wrote:

> Hello all,
>
> I posted this earlier, but didn't receive a copy from the list.  So I'm
> posting again in the hopes of some suggestions.
>
> I'm trying to find out how to setup initialization parameters for a jsp.
> The config implicit object exists, and is obviously meant to make it
> possible to access these parameters from the JSP, but how do I identify
> the values for these parameters in servelet.properties?  I don't really
> have a name to use for each particular jsp, as the actual servlet
> used is generated dynamically.
>

In a servlet container compatible with the version 2.2 API (such as Jakarta
Tomcat), you can set up a servlet entry in your deployment descriptor that uses the
name of the JSP page:

<web-app>
    ...
    <servlet>
        <servlet-name>MyServlet</servlet-name>
        <jsp-file>mypage.jsp</jsp-file>
        <init-param>
            <param-name>param1</param-name>
            <param-value>The value of this parameter</param-value>
        </init-param>
        ...
    </servlet>
    ...
</web-app>

These parameters will be picked up by the init() method of the generated servlet,
and are available in your JSP page in a scriptlet like this:

<%
    String value =
      getServletConfig().getInitParameter("param1");
%>

>
> I'd appreciate any suggestion!
> Thanks,
> -AMT
>

Craig McClanahan

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to