struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From germu...@apache.org
Subject cvs commit: jakarta-struts/src/share/org/apache/struts/taglib/tiles PutTag.java
Date Mon, 17 May 2004 17:38:09 GMT
germuska    2004/05/17 10:38:09

  Modified:    src/share/org/apache/struts/taglib/tiles PutTag.java
  Log:
  Manage tag body content more carefully -- in some servlet containers, pooled
  tags were displaying old content with empty tiles:put tags.
  PR: 28269
  Submitted by: Niall Pemberton
  
  Revision  Changes    Path
  1.11      +29 -5     jakarta-struts/src/share/org/apache/struts/taglib/tiles/PutTag.java
  
  Index: PutTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/tiles/PutTag.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- PutTag.java	14 Mar 2004 06:23:49 -0000	1.10
  +++ PutTag.java	17 May 2004 17:38:09 -0000	1.11
  @@ -114,6 +114,11 @@
       protected Object realValue = null;
   
       /**
  +     * The body content of this tag.
  +     */
  +    protected String body = null;
  +
  +    /**
        * Default constructor.
        */
       public PutTag() {
  @@ -135,6 +140,7 @@
           beanProperty = null;
           beanScope = null;
           role = null;
  +        body = null;
       }
   
       /**
  @@ -317,8 +323,8 @@
           // If realValue is not set, value must come from body
           if (value == null && beanName == null) {
               // Test body content in case of empty body.
  -            if (bodyContent != null) {
  -                realValue = bodyContent.getString();
  +            if (body != null) {
  +                realValue = body;
               } else {
                   realValue = "";
               }
  @@ -422,6 +428,10 @@
        * Do start tag.
        */
       public int doStartTag() throws JspException {
  +
  +        // clear body content
  +        body = null;
  +
           // Do we need to evaluate body ?
           if (value == null && beanName == null) {
               return EVAL_BODY_TAG;
  @@ -429,6 +439,20 @@
   
           // Value is set, don't evaluate body.
           return SKIP_BODY;
  +    }
  +
  +    /**
  +     * Save the body content of this tag (if any)
  +     *
  +     * @exception JspException if a JSP exception has occurred
  +     */
  +    public int doAfterBody() throws JspException {
  +
  +        if (bodyContent != null) {
  +            body = bodyContent.getString();
  +        }
  +        return (SKIP_BODY);
  +
       }
   
       /**
  
  
  

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


Mime
View raw message