tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu...@apache.org
Subject cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler PageDataImpl.java
Date Sat, 05 Apr 2003 02:40:17 GMT
luehe       2003/04/04 18:40:17

  Modified:    jasper2/src/share/org/apache/jasper/compiler
                        PageDataImpl.java
  Log:
  Fixed bug in determination logic of when to add
    xmlns:jsp="http://java.sun.com/JSP/Page"
  attribute to <jsp:root> of XML view.
  
  Revision  Changes    Path
  1.28      +17 -11    jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/PageDataImpl.java
  
  Index: PageDataImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/PageDataImpl.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- PageDataImpl.java	27 Mar 2003 01:52:55 -0000	1.27
  +++ PageDataImpl.java	5 Apr 2003 02:40:17 -0000	1.28
  @@ -92,7 +92,7 @@
    */
   class PageDataImpl extends PageData implements TagConstants {
   
  -    private static final String JSP_NAMESPACE = "http://java.sun.com/JSP/Page";
  +    private static final String JSP_URI = "http://java.sun.com/JSP/Page";
       private static final String JSP_VERSION = "2.0";
       private static final String CDATA_START_SECTION = "<![CDATA[\n";
       private static final String CDATA_END_SECTION = "]]>\n";
  @@ -158,17 +158,23 @@
   	    this.rootAttrs = new AttributesImpl();
   	    this.rootAttrs.addAttribute("", "", "version", "CDATA",
   					JSP_VERSION);
  -	    if (!root.isXmlSyntax()) {
  -		this.rootAttrs.addAttribute("", "", "xmlns:jsp", "CDATA",
  -					    JSP_NAMESPACE);
  -	    } 
   	}
   
   	public void visit(Node.Root n) throws JasperException {
   	    visitBody(n);
  -	    if (n == this.root) {
  -		// top-level page
  -		this.root.setAttributes(rootAttrs);
  +	    if (n == root) {
  +		/*
  +		 * Top-level page.
  +		 *
  +		 * Add
  +		 *   xmlns:jsp="http://java.sun.com/JSP/Page"
  +		 * attribute only if not already present.
  +		 */
  +		if (!JSP_URI.equals(rootAttrs.getValue("xmlns:jsp"))) {
  +		    rootAttrs.addAttribute("", "", "xmlns:jsp", "CDATA",
  +					   JSP_URI);
  +		}
  +		root.setAttributes(rootAttrs);
   	    }
   	}
   
  
  
  

---------------------------------------------------------------------
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