You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2002/10/02 23:25:42 UTC

DO NOT REPLY [Bug 13223] New: - JSP pages in XML syntax do not compile properly

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13223>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13223

JSP pages in XML syntax do not compile properly

           Summary: JSP pages in XML syntax do not compile properly
           Product: Tomcat 4
           Version: 4.1.12
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Jasper 2
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: Joseph.Sinclair@Motorola.Com


When using the XML syntax for JSP pages, compile errors are thrown whenever an 
XML-syntax JSP tag is used to apply an attribute value as in this JSP page:
____________________________________________________________________
This JSP fails:
____________________________________________________________________
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
          version="1.2">
<jsp:directive.page language="java" import="java.text.*" session="false" 
isThreadSafe="true" isErrorPage="false"  />
<jsp:scriptlet>
java.text.Annotation recordDetails = new java.text.Annotation("This is a test 
value");
pageContext.setAttribute("recordDetails", recordDetails, 
PageContext.PAGE_SCOPE);
</jsp:scriptlet>
<html>
<head>
  <title><jsp:expression>System.getProperty("java.io.tmpdir")
</jsp:expression></title>
</head>
<body>
  <table class="EntryFormContainer" cols="6" cellpadding="1" cellspacing="1" 
border="0">
    <tr>
      <td align="right">Case ID:</td>
      <td align="left" colspan="7"><input type="text" name="caseID" 
READONLY="true" value='<jsp:getProperty name="recordDetails" 
property="value" />' class="DisabledField"/></td>
    </tr>
  </table>
</body>
</html>
</jsp:root>


____________________________________________________________________
This JSP works:
____________________________________________________________________
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
          version="1.2">
<jsp:directive.page language="java" import="java.text.*" session="false" 
isThreadSafe="true" isErrorPage="false"  />
<jsp:scriptlet>
java.text.Annotation recordDetails = new java.text.Annotation("This is a test 
value");
pageContext.setAttribute("recordDetails", recordDetails, 
PageContext.PAGE_SCOPE);
</jsp:scriptlet>
<html>
<head>
  <title><jsp:expression>System.getProperty("java.io.tmpdir")
</jsp:expression></title>
</head>
<body>
  <table class="EntryFormContainer" cols="6" cellpadding="1" cellspacing="1" 
border="0">
    <tr>
      <td align="right">Case ID:</td>
      <td align="left" colspan="7"><input type="text" name="caseID" 
READONLY="true" value="" class="DisabledField"/><jsp:getProperty 
name="recordDetails" property="value" /></td>
    </tr>
  </table>
</body>
</html>
</jsp:root>

____________________________________________________________________
This JSP also fails:
____________________________________________________________________
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
          version="1.2">
<jsp:directive.page language="java" import="java.text.*" session="false" 
isThreadSafe="true" isErrorPage="false"  />
<jsp:scriptlet>
java.text.Annotation recordDetails = new java.text.Annotation("This is a test 
value");
pageContext.setAttribute("recordDetails", recordDetails, 
PageContext.PAGE_SCOPE);
</jsp:scriptlet>
<html>
<head>
  <title><jsp:expression>System.getProperty("java.io.tmpdir")
</jsp:expression></title>
</head>
<body>
  <table class="EntryFormContainer" cols="6" cellpadding="1" cellspacing="1" 
border="0">
    <tr>
      <td align="right">Case ID:</td>
      <td align="left" colspan="7"><input type="text" name="caseID" 
READONLY="true" value='jsp:getProperty name="recordDetails" property="value"' 
class="DisabledField"/></td>
    </tr>
  </table>
</body>
</html>
</jsp:root>

Several additional variations on the above themes also fail.
The spec appears to support the first JSP example.  On the chance that I might 
have misread the spec, I also tried it without the < and />, this variation 
also fails.
It may be worth noting that this exact same example JSP works, as long as the 
jsp:root tag is removed and the page, scriptlet, and expression tags are 
replaced with their non-XML equivalents as follows:
<%@page language="java" import="java.text.*" session="false" 
isThreadSafe="true" isErrorPage="false" %>
<%
java.text.Annotation recordDetails = new java.text.Annotation("This is a test 
value");
pageContext.setAttribute("recordDetails", recordDetails, 
PageContext.PAGE_SCOPE);
%>
<html>
<head>
  <title><%=System.getProperty("java.io.tmpdir")%></title>
</head>
<body>
  <table class="EntryFormContainer" cols="6" cellpadding="1" cellspacing="1" 
border="0">
    <tr>
      <td align="right">Case ID:</td>
      <td align="left" colspan="7"><input type="text" name="caseID" 
READONLY="true" value='<jsp:getProperty name="recordDetails" 
property="value" />' class="DisabledField"/></td>
    </tr>
  </table>
</body>
</html>

In summary, it appears that the XML syntax is not supported in attribute value 
assignment.

The exception thrown is as follows (Note the problem in property lookup, this 
may be another, unrelated, bug).

type Exception report

message 

description The server encountered an internal error () that prevented it from 
fulfilling this request.

exception 

org.apache.jasper.JasperException: Unable to compile class for JSP
	at org.apache.jasper.JspCompilationContext.compile
(JspCompilationContext.java:479)
	at org.apache.jasper.servlet.JspServletWrapper.service
(JspServletWrapper.java:184)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile
(JspServlet.java:289)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:247)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperValve.java:260)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextValve.java:191)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardContext.invoke
(StandardContext.java:2396)
	at org.apache.catalina.core.StandardHostValve.invoke
(StandardHostValve.java:180)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:643)
	at org.apache.catalina.valves.ErrorDispatcherValve.invoke
(ErrorDispatcherValve.java:170)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:641)
	at org.apache.catalina.valves.ErrorReportValve.invoke
(ErrorReportValve.java:172)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:641)
	at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineValve.java:174)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.coyote.tomcat4.CoyoteAdapter.service
(CoyoteAdapter.java:223)
	at org.apache.coyote.http11.Http11Processor.process
(Http11Processor.java:405)
	at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnectio
n(Http11Protocol.java:380)
	at org.apache.tomcat.util.net.TcpWorkerThread.runIt
(PoolTcpEndpoint.java:508)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run
(ThreadPool.java:533)
	at java.lang.Thread.run(Thread.java:484)


root cause 

java.lang.NullPointerException
	at java.util.Hashtable.get(Hashtable.java:320)
	at java.util.PropertyResourceBundle.handleGetObject
(PropertyResourceBundle.java:105)
	at java.util.ResourceBundle.getObject(ResourceBundle.java:376)
	at java.util.ResourceBundle.getString(ResourceBundle.java:354)
	at org.apache.jasper.compiler.ErrorDispatcher.getString
(ErrorDispatcher.java:364)
	at org.apache.jasper.compiler.ErrorDispatcher.dispatch
(ErrorDispatcher.java:398)
	at org.apache.jasper.compiler.ErrorDispatcher.jspError
(ErrorDispatcher.java:245)
	at org.apache.jasper.compiler.JspDocumentParser.parse
(JspDocumentParser.java:167)
	at org.apache.jasper.compiler.ParserController.parse
(ParserController.java:193)
	at org.apache.jasper.compiler.ParserController.parse
(ParserController.java:153)
	at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:219)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:323)
	at org.apache.jasper.JspCompilationContext.compile
(JspCompilationContext.java:474)
	at org.apache.jasper.servlet.JspServletWrapper.service
(JspServletWrapper.java:184)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile
(JspServlet.java:289)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:247)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperValve.java:260)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextValve.java:191)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardContext.invoke
(StandardContext.java:2396)
	at org.apache.catalina.core.StandardHostValve.invoke
(StandardHostValve.java:180)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:643)
	at org.apache.catalina.valves.ErrorDispatcherValve.invoke
(ErrorDispatcherValve.java:170)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:641)
	at org.apache.catalina.valves.ErrorReportValve.invoke
(ErrorReportValve.java:172)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:641)
	at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineValve.java:174)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke
(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.coyote.tomcat4.CoyoteAdapter.service
(CoyoteAdapter.java:223)
	at org.apache.coyote.http11.Http11Processor.process
(Http11Processor.java:405)
	at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnectio
n(Http11Protocol.java:380)
	at org.apache.tomcat.util.net.TcpWorkerThread.runIt
(PoolTcpEndpoint.java:508)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run
(ThreadPool.java:533)
	at java.lang.Thread.run(Thread.java:484)

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>