kinman 2002/08/08 13:41:03 Modified: jasper2/src/share/org/apache/jasper/compiler Generator.java Parser.java TagFileProcessor.java Validator.java jasper2/src/share/org/apache/jasper/resources messages.properties Log: - Mod to use new JSP api - Implement isELEnabled attribute to page directive - Add other new (PD2) attributes to tag directive. Revision Changes Path 1.64 +12 -14 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java Index: Generator.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v retrieving revision 1.63 retrieving revision 1.64 diff -u -r1.63 -r1.64 --- Generator.java 8 Aug 2002 11:04:51 -0000 1.63 +++ Generator.java 8 Aug 2002 20:41:02 -0000 1.64 @@ -859,7 +859,7 @@ public void visit(Node.ELExpression n) throws JasperException { n.setBeginJavaLine(out.getJavaLine()); - if ( true /*isELEnabled*/ ) { + if ( pageInfo.isELEnabled() ) { out.printil( "out.write(" + JspUtil.interpreterCall(this.isTagFile, @@ -1987,7 +1987,11 @@ out.print(tagHandlerVar); out.println(".doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE)"); out.pushIndent(); - out.printil((methodNesting > 0)? "return true;": "return;"); + if (isTagFile) { + out.printil("throw new javax.servlet.jsp.SkipPageException();"); + } else { + out.printil((methodNesting > 0)? "return true;": "return;"); + } out.popIndent(); // Synchronize AT_BEGIN and AT_END scripting variables @@ -2089,12 +2093,8 @@ isSimpleTagHandler = tmpIsSimpleTagHandler; } - out.printin("if ("); - out.print(tagHandlerVar); - out.println(".doTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE)"); - out.pushIndent(); - out.printil((methodNesting > 0)? "return true;": "return;"); - out.popIndent(); + out.printin(tagHandlerVar); + out.println(".doTag();"); // Synchronize AT_BEGIN and AT_END scripting variables syncScriptingVariables(n, VariableInfo.AT_BEGIN); @@ -2818,7 +2818,7 @@ if (tagInfo.hasDynamicAttributes()) generateSetDynamicAttribute(); - out.printil("public int doTag() throws javax.servlet.jsp.JspException {"); + out.printil("public void doTag() throws javax.servlet.jsp.JspException {"); out.pushIndent(); // Declare parameter map for fragment/body invocation out.printil("java.util.Map params = null;"); @@ -2845,8 +2845,6 @@ out.printil("getJspContext().popPageScope();"); out.popIndent(); out.printil("}"); - out.println(); - out.printil("return EVAL_PAGE;"); out.popIndent(); out.printil("}"); out.popIndent(); 1.19 +3 -7 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java Index: Parser.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- Parser.java 1 Aug 2002 20:55:04 -0000 1.18 +++ Parser.java 8 Aug 2002 20:41:02 -0000 1.19 @@ -133,10 +133,6 @@ boolean isTagFile) throws JasperException { Parser parser = new Parser(pc, reader, isTagFile); - // Tag files takes only scriptless body. - if (isTagFile) - parser.scriptlessCount++; - Node.Root root = new Node.Root(null, reader.mark(), parent); while (reader.hasMoreInput()) { 1.11 +20 -8 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagFileProcessor.java Index: TagFileProcessor.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagFileProcessor.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- TagFileProcessor.java 6 Aug 2002 00:11:36 -0000 1.10 +++ TagFileProcessor.java 8 Aug 2002 20:41:03 -0000 1.11 @@ -95,7 +95,11 @@ new JspUtil.ValidAttribute("large-icon"), new JspUtil.ValidAttribute("description"), new JspUtil.ValidAttribute("example"), - new JspUtil.ValidAttribute("pageEncoding") }; + new JspUtil.ValidAttribute("pageEncoding"), + new JspUtil.ValidAttribute("language"), + new JspUtil.ValidAttribute("import"), + new JspUtil.ValidAttribute("isScriptingEnabled"), + new JspUtil.ValidAttribute("isELEnabled") }; private static final JspUtil.ValidAttribute[] attributeDirectiveAttrs = { new JspUtil.ValidAttribute("name", true), @@ -152,8 +156,12 @@ err); String tname = n.getAttributeValue("name"); - if (tname != null && name != null && !tname.equals(name)) { - err.jspError("jsp.error.tagfile.tld.name", name, tname); + if (tname != null) { + if (name == null) { + name = tname; + } else if (!tname.equals(name)) { + err.jspError("jsp.error.tagfile.tld.name", name, tname); + } } bodycontent = n.getAttributeValue("body-content"); if (bodycontent != null && @@ -184,13 +192,17 @@ boolean fragment = JspUtil.booleanValue( n.getAttributeValue("fragment")); String type = n.getAttributeValue("type"); - if (type == null) - type = "java.lang.String"; - if (fragment) { n.setFragmentInputs(new Vector()); fragmentAttributesMap.put(name, n); + + if (type != null) { + err.jspError("jsp.error.fragmentwithtype"); + } } else { + if (type == null) + type = "java.lang.String"; + attributeVector.addElement( new TagAttributeInfo(name, required, type, rtexprvalue)); } 1.20 +14 -5 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java Index: Validator.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- Validator.java 5 Aug 2002 23:46:29 -0000 1.19 +++ Validator.java 8 Aug 2002 20:41:03 -0000 1.20 @@ -111,7 +111,8 @@ new JspUtil.ValidAttribute("isErrorPage"), new JspUtil.ValidAttribute("contentType"), new JspUtil.ValidAttribute("pageEncoding"), - new JspUtil.ValidAttribute("isScriptingEnabled") + new JspUtil.ValidAttribute("isScriptingEnabled"), + new JspUtil.ValidAttribute("isELEnabled") }; private boolean languageSeen = false; @@ -227,6 +228,14 @@ pageInfo.setScriptingEnabled(false); else err.jspError(n, "jsp.error.isScriptingEnabled.invalid"); + } else if ("isELEnabled".equals(attr)) { + // XXX Test for multiple occurrence? + if ("true".equalsIgnoreCase(value)) + pageInfo.setELEnabled(true); + else if ("false".equalsIgnoreCase(value)) + pageInfo.setELEnabled(false); + else + err.jspError(n, "jsp.error.isELEnabled.invalid"); } else if ("isErrorPage".equals(attr)) { if (isErrorPageSeen) err.jspError(n, "jsp.error.page.multiple.iserrorpage"); @@ -549,7 +558,7 @@ } public void visit(Node.ELExpression n) throws JasperException { - if ( true /*isELEnabled*/ ) { + if ( pageInfo.isELEnabled() ) { JspUtil.validateExpressions(n.getStart(), "${" + new String(n.getText()) + "}", err); } 1.22 +3 -2 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages.properties Index: messages.properties =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages.properties,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- messages.properties 1 Aug 2002 21:19:09 -0000 1.21 +++ messages.properties 8 Aug 2002 20:41:03 -0000 1.22 @@ -276,8 +276,9 @@ jsp.error.tld.fn.invalid.signature=Invalid syntax for function signature in TLD. Tag Library: {0}, Function: {1} jsp.error.dynamic.attributes.not.implemented=The {0} tag declares that it accepts dynamic attributes but does not implement the required interface -jsp.error.nomatching.fragment=an attribute directive whose name attribute equals {0} and whose fragment attribute equals true must be declared prior to this directive. +jsp.error.nomatching.fragment=Cannot find an attribute directive (with name={0} and fragment=true) prior to the fragment directive. jsp.error.attribute.noequal=equal symbol expected jsp.error.attribute.noquote=quote symbol expected jsp.error.attribute.unterminated=attribute for {0} is not properly terminated jsp.error.missing.tagInfo=TagInfo object for {0} is missing from TLD +jsp.error.fragmentwithtype=Both fragment and type attribute specified in a tag directive
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>