https://issues.apache.org/bugzilla/show_bug.cgi?id=54663

            Bug ID: 54663
           Summary: JSP Comment processing in jsp:include
           Product: Tomcat 7
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Jasper
          Assignee: dev@tomcat.apache.org
          Reporter: bluewolf.ch...@gmail.com
    Classification: Unclassified

<%@ page contentType="text/html;charset=utf-8" %>

<jsp:include page="another.jsp">
    <jsp:param name="1" value="hello"/>
    <%-- <jsp:param name="2" value="hello2"/> --%>
</jsp:include>


I tried to find any spec. statements about comment usages within standard
action tags but I couldn't.
So I think the usage of comment like above is tolerable but compilation is
always failed.

org.apache.jasper.JasperException: /test.jsp (line: 5, column: 4) Expecting
"jsp:param" standard action with "name" and "value" attributes
    at
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42)
    at
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:408)
    at
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:89)
    at org.apache.jasper.compiler.Parser.parseParam(Parser.java:825)
    at org.apache.jasper.compiler.Parser.parseBody(Parser.java:1674)
    at org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:1002)
    at org.apache.jasper.compiler.Parser.parseInclude(Parser.java:854)
    at org.apache.jasper.compiler.Parser.parseStandardAction(Parser.java:1116)
    at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1453)
    at org.apache.jasper.compiler.Parser.parse(Parser.java:138)
    at
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:256)
    at
org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
    at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:199)
        .........


I suggest the code like below:

package org.apache.jasper.compiler;

class Parser implements TagConstants {

    private void parseBody(Node parent, String tag, String bodyType)
            throws JasperException {

            ...

            while (reader.hasMoreInput()) {
                ...

                } else if (bodyType == JAVAX_BODY_CONTENT_PARAM) {
                    if (reader.matches("<%--")) {
                        parseComment(parent);
                        reader.skipSpaces();
                        continue;
                    }
                    // (note the == since we won't recognize JAVAX_*
                    // from outside this module).
                    reader.skipSpaces();
                    parseParam(parent);
                } else if (bodyType == JAVAX_BODY_CONTENT_TEMPLATE_TEXT) {

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

Reply via email to