jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject cvs commit: jakarta-taglibs/xtags/src/org/apache/taglibs/xtags/xpath TagHelper.java
Date Tue, 11 Sep 2001 11:27:08 GMT
jstrachan    01/09/11 04:27:08

  Modified:    xtags/src/org/apache/taglibs/xtags/xpath TagHelper.java
  Added:       xtags/examples/web/test test_for_each_context.jsp
  Log:
  Added patch to bug found by and the test case submitted by Manuel Tromm - many thanks Manuel
  
  Revision  Changes    Path
  1.1                  jakarta-taglibs/xtags/examples/web/test/test_for_each_context.jsp
  
  Index: test_for_each_context.jsp
  ===================================================================
  <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
  <html>
  <%@ taglib uri="http://jakarta.apache.org/taglibs/xtags-1.0" prefix="xtags" %>
  
  <%@ page import = "java.util.*"%>
  <%@ page import = "org.dom4j.*"%>
  <%@ page import = "org.dom4j.io.SAXReader"%>
  <%@ page import = "java.io.StringReader"%>
  
  
  <%
  SAXReader reader = new SAXReader();
  Document formDoc = reader.read( new StringReader("<?xml version=\"1.0\" encoding=\"UTF-8\"
?> <foo>  <bar>de</bar> <bar>de</bar> <bar>de</bar>
<bar>de</bar> <bar>de</bar>  </foo>") );
  %>
  
  
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>Test ForEach/Context Example</title>
  </head>
  
  <body>
  
  <h1>Test ForEach/Context Example</h1>
  
  <p>About to iterate over the document, we should find something</p>
  
  <hr/>
  
  <xtags:forEach select="/foo/bar" context="<%=formDoc%>">
  
  <p>
    Found a bar!!
  </p>
  
  </xtags:forEach>
  
  <hr/>
  
  </body>
  </html>
  
  
  1.3       +22 -10    jakarta-taglibs/xtags/src/org/apache/taglibs/xtags/xpath/TagHelper.java
  
  Index: TagHelper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/xtags/src/org/apache/taglibs/xtags/xpath/TagHelper.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TagHelper.java	2001/07/25 18:40:06	1.2
  +++ TagHelper.java	2001/09/11 11:27:07	1.3
  @@ -157,16 +157,28 @@
       }
       
       public static void setInputNodes( PageContext pageContext, Object inputNodes ) {
  -        pageContext.setAttribute( 
  -            REQUEST_KEY_CONTEXT,  
  -            inputNodes, 
  -            PageContext.PAGE_SCOPE 
  -        );
  -        pageContext.setAttribute( 
  -            REQUEST_KEY_CONTEXT,  
  -            inputNodes, 
  -            PageContext.REQUEST_SCOPE 
  -        );
  +        if ( inputNodes == null ) {
  +            pageContext.removeAttribute( 
  +                REQUEST_KEY_CONTEXT,  
  +                PageContext.PAGE_SCOPE 
  +            );
  +            pageContext.removeAttribute( 
  +                REQUEST_KEY_CONTEXT,  
  +                PageContext.REQUEST_SCOPE 
  +            );
  +        }
  +        else {
  +            pageContext.setAttribute( 
  +                REQUEST_KEY_CONTEXT,  
  +                inputNodes, 
  +                PageContext.PAGE_SCOPE 
  +            );
  +            pageContext.setAttribute( 
  +                REQUEST_KEY_CONTEXT,  
  +                inputNodes, 
  +                PageContext.REQUEST_SCOPE 
  +            );
  +        }
       }
       
       public static Stylesheet getStylesheet(PageContext pageContext) {
  
  
  

Mime
View raw message