You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by ar...@apache.org on 2003/10/04 08:12:32 UTC

cvs commit: jakarta-struts/src/share/org/apache/struts/taglib/nested NestedWriteNestingTag.java

arron       2003/10/03 23:12:32

  Modified:    doc/userGuide struts-nested.xml
               src/share/org/apache/struts/taglib/nested
                        NestedWriteNestingTag.java
  Log:
  Updated the WriteNesting tag to allow it to make a scripting
  variable like it says it can in the documentation.
  
  Revision  Changes    Path
  1.23      +12 -1     jakarta-struts/doc/userGuide/struts-nested.xml
  
  Index: struts-nested.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/doc/userGuide/struts-nested.xml,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- struts-nested.xml	11 Sep 2003 21:31:23 -0000	1.22
  +++ struts-nested.xml	4 Oct 2003 06:12:32 -0000	1.23
  @@ -120,9 +120,10 @@
     <tag>
       <name>writeNesting</name>
       <summary>
  -      Writes out the current nesting level, or that defined by a property
  +      Writes or makes a scripting variable of the current nesting level.
       </summary>
       <tagclass>org.apache.struts.taglib.nested.NestedWriteNestingTag</tagclass>
  +    <teiclass>org.apache.struts.taglib.nested.NestedWriteNestingTei</teiclass>
       <bodycontent>JSP</bodycontent>
       <info>
         This tag provides a way of accessing the nested property reference used by
  @@ -135,6 +136,16 @@
         <rtexprvalue>true</rtexprvalue>
         <info>
           If not supplied, will simply write out as if "./" or "this/" was supplied.
  +      </info>
  +    </attribute>
  +    <attribute>
  +      <name>id</name>
  +      <required>false</required>
  +      <rtexprvalue>true</rtexprvalue>
  +      <info>
  +        If <i>id</i> is supplied, then what would have been written out into the
  +        response stream, will instead be made available as a String object
  +        defined by the variable name provided.
         </info>
       </attribute>
       <attribute>
  
  
  
  1.7       +30 -8     jakarta-struts/src/share/org/apache/struts/taglib/nested/NestedWriteNestingTag.java
  
  Index: NestedWriteNestingTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/NestedWriteNestingTag.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- NestedWriteNestingTag.java	31 Jul 2003 00:34:15 -0000	1.6
  +++ NestedWriteNestingTag.java	4 Oct 2003 06:12:32 -0000	1.7
  @@ -92,6 +92,21 @@
     }
   
   
  +  /** Getter method for the <i>id</i> property
  +   * @return String value for the id property
  +   */
  +  public String getId() {
  +        return id;
  +  }
  +
  +  /** Setter method for the <i>id</i> property
  +   * @param id new value for the id property
  +   */
  +  public void setId(String id) {
  +    this.id = id;
  +  }
  +
  +
     /** Getter method for the <i>filter</i> property
      * @return String value of the filter property
      */
  @@ -120,11 +135,17 @@
       HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
       String nesting = NestedPropertyHelper.getAdjustedProperty(request, property);
   
  -    /* write output, filtering if required */
  -    if (this.filter) {
  -      TagUtils.getInstance().write(pageContext, TagUtils.getInstance().filter(nesting));
  +    if (id != null) {
  +      // use it as a scripting variable instead
  +      pageContext.setAttribute(id, nesting);
  +
       } else {
  -      TagUtils.getInstance().write(pageContext, nesting);
  +      /* write output, filtering if required */
  +      if (this.filter) {
  +        TagUtils.getInstance().write(pageContext, TagUtils.getInstance().filter(nesting));
  +      } else {
  +        TagUtils.getInstance().write(pageContext, nesting);
  +      }
       }
   
       /* continue with page processing */
  @@ -154,5 +175,6 @@
     /* the usual private member variables */
     private boolean filter = false;
     private String property = null;
  +  private String id = null;
     private String originalProperty = null;
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org