tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 33564] New: - Servlet Init Params for a jsp cannot be obtained
Date Mon, 14 Feb 2005 16:20:50 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=33564>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=33564

           Summary: Servlet Init Params for a jsp cannot be obtained
           Product: Tomcat 5
           Version: 5.5.4
          Platform: Sun
        OS/Version: Solaris
            Status: NEW
          Severity: normal
          Priority: P3
         Component: Unknown
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: bruce.evans@sun.com
                CC: bruce.evans@sun.com


If Servlet Init Params are set in the DD for a jsp, the jsp cannot access those
params.

*** DD:
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
         version="2.4">

    <servlet>
     <jsp-file>/jspApp1.jsp</jsp-file>
     <init-param>
       <param-name>jspJspParm1</param-name>
       <param-value>jspJspValue1</param-value>
     </init-param>
     <init-param>
       <param-name>jspJspParm2</param-name>
       <param-value>jspJspValue2</param-value>
     </init-param>
    </servlet>
</web-app>

*** JSP:
<%@ page import="java.util.*" %>
<%!
  public void jspInit() {
    try {
      System.out.println("Enter: jspInit()");
      ServletConfig sc = getServletConfig();
      Enumeration e = sc.getInitParameterNames();
      while (e.hasMoreElements()) 
        System.out.println("ServletConfig Param Name:" + e.nextElement());

      System.out.println("Exit: jspInit()");
    } catch (Exception e) {}
  }
%>
<html><body bgcolor=black><font color=pink size=+2>
<%= "In _jspService()" %>
<%
  Enumeration e = config.getInitParameterNames();
  while (e.hasMoreElements()) 
    out.println("<p>ServletConfig Param Name:" + e.nextElement());

  out.println("<p>Exit: _jspService()");
%>
</font></body></html>

*** Output to Browser:
In _jspService()
ServletConfig Param Name:fork
ServletConfig Param Name:xpoweredBy
Exit: _jspService() 

*** Output to Catalina.out
Enter: jspInit()
ServletConfig Param Name:fork
ServletConfig Param Name:xpoweredBy
Exit: jspInit()

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message