arron 2003/02/27 21:14:40 Modified: src/share/org/apache/struts/taglib/nested/logic NestedNotPresentTag.java NestedEqualTag.java NestedNotEmptyTag.java NestedGreaterThanTag.java NestedIterateTei.java NestedGreaterEqualTag.java NestedIterateTag.java NestedMessagesNotPresentTag.java NestedMatchTag.java NestedLessThanTag.java NestedPresentTag.java NestedNotMatchTag.java NestedMessagesPresentTag.java NestedNotEqualTag.java NestedLessEqualTag.java NestedEmptyTag.java Log: Logic Nested Tag Clases - Most importantly, updated the Copyright to include 2003. - Secondly, rejig of the nested tags to allow them to dance with Tomcat 4.1.18 Revision Changes Path 1.4 +46 -34 jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedNotPresentTag.java Index: NestedNotPresentTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedNotPresentTag.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- NestedNotPresentTag.java 16 Nov 2002 04:41:28 -0000 1.3 +++ NestedNotPresentTag.java 28 Feb 2003 05:14:39 -0000 1.4 @@ -6,7 +6,7 @@ * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2001 The Apache Software Foundation. All rights + * Copyright (c) 1999-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -59,6 +59,7 @@ */ package org.apache.struts.taglib.nested.logic; +import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.logic.NotPresentTag; @@ -73,7 +74,7 @@ * @version $Revision$ $Date$ */ public class NestedNotPresentTag extends NotPresentTag implements NestedNameSupport { - + /** * Overriding method of the heart of the matter. Gets the relative property * and leaves the rest up to the original tag implementation. Sweet. @@ -81,37 +82,48 @@ * This is in the hands of the super class. */ public int doStartTag() throws JspException { - - /* singleton tag implementations will need the original property to be - set before running */ - super.setProperty(originalProperty); - - /* let the NestedHelper set the properties it can */ - isNesting = true; - NestedPropertyHelper.setNestedProperties(this); - isNesting = false; - - /* do the tag */ + // get the original properties + originalName = getName(); + originalProperty = getProperty(); + + // request + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + // set the properties + NestedPropertyHelper.setNestedProperties(request, this); + + // let the super do it's thing return super.doStartTag(); } - - /** this is overridden so that properties being set by the JSP page aren't - * written over by those needed by the extension. If the tag instance is - * re-used by the JSP, the tag can set the property back to that set by the - * JSP page. - * - * @param newProperty new property value + + /** + * Complete the processing of the tag. The nested tags here will restore + * all the original value for the tag itself and the nesting context. + * @return int to describe the next step for the JSP processor + * @throws JspException for the bad things JSP's do + */ + public int doEndTag() throws JspException { + // do the super's ending part + int i = super.doEndTag(); + + // reset the properties + setName(originalName); + setProperty(originalProperty); + + // continue + return i; + } + + /** + * Release the tag's resources and reset the values. */ - public void setProperty(String newProperty) { - /* let the real tag do its thang */ - super.setProperty(newProperty); - /* if it's the JSP setting it, remember the value */ - if (!isNesting) { - originalProperty = newProperty; - } + public void release() { + super.release(); + // reset the originals + originalName = null; + originalProperty = null; } - - /* hold original property */ + + /* the usual private member variables */ + private String originalName = null; private String originalProperty = null; - private boolean isNesting = false; } 1.4 +48 -37 jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedEqualTag.java Index: NestedEqualTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedEqualTag.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- NestedEqualTag.java 16 Nov 2002 04:41:28 -0000 1.3 +++ NestedEqualTag.java 28 Feb 2003 05:14:39 -0000 1.4 @@ -6,7 +6,7 @@ * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2001 The Apache Software Foundation. All rights + * Copyright (c) 1999-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -59,12 +59,12 @@ */ package org.apache.struts.taglib.nested.logic; +import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.logic.EqualTag; import org.apache.struts.taglib.nested.NestedNameSupport; import org.apache.struts.taglib.nested.NestedPropertyHelper; -import org.apache.struts.taglib.nested.NestedPropertySupport; /** * NestedEqualTag. @@ -73,8 +73,8 @@ * @since Struts 1.1 * @version $Revision$ $Date$ */ -public class NestedEqualTag extends EqualTag implements NestedPropertySupport, NestedNameSupport { - +public class NestedEqualTag extends EqualTag implements NestedNameSupport { + /** * Overriding method of the heart of the matter. Gets the relative property * and leaves the rest up to the original tag implementation. Sweet. @@ -82,37 +82,48 @@ * This is in the hands of the super class. */ public int doStartTag() throws JspException { - - /* singleton tag implementations will need the original property to be - set before running */ - super.setProperty(originalProperty); - - /* let the NestedHelper set the properties it can */ - isNesting = true; - NestedPropertyHelper.setNestedProperties(this); - isNesting = false; - - /* do the tag */ + // get the original properties + originalName = getName(); + originalProperty = getProperty(); + + // request + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + // set the properties + NestedPropertyHelper.setNestedProperties(request, this); + + // let the super do it's thing return super.doStartTag(); } - - /** this is overridden so that properties being set by the JSP page aren't - * written over by those needed by the extension. If the tag instance is - * re-used by the JSP, the tag can set the property back to that set by the - * JSP page. - * - * @param newProperty new property value + + /** + * Complete the processing of the tag. The nested tags here will restore + * all the original value for the tag itself and the nesting context. + * @return int to describe the next step for the JSP processor + * @throws JspException for the bad things JSP's do + */ + public int doEndTag() throws JspException { + // do the super's ending part + int i = super.doEndTag(); + + // reset the properties + setName(originalName); + setProperty(originalProperty); + + // continue + return i; + } + + /** + * Release the tag's resources and reset the values. */ - public void setProperty(String newProperty) { - /* let the real tag do its thang */ - super.setProperty(newProperty); - /* if it's the JSP setting it, remember the value */ - if (!isNesting) { - originalProperty = newProperty; - } + public void release() { + super.release(); + // reset the originals + originalName = null; + originalProperty = null; } - - /* hold original property */ + + /* the usual private member variables */ + private String originalName = null; private String originalProperty = null; - private boolean isNesting = false; -} \ No newline at end of file +} 1.4 +46 -34 jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedNotEmptyTag.java Index: NestedNotEmptyTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedNotEmptyTag.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- NestedNotEmptyTag.java 16 Nov 2002 04:41:28 -0000 1.3 +++ NestedNotEmptyTag.java 28 Feb 2003 05:14:39 -0000 1.4 @@ -6,7 +6,7 @@ * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2001 The Apache Software Foundation. All rights + * Copyright (c) 1999-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -59,6 +59,7 @@ */ package org.apache.struts.taglib.nested.logic; +import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.logic.NotEmptyTag; @@ -73,7 +74,7 @@ * @version $Revision$ $Date$ */ public class NestedNotEmptyTag extends NotEmptyTag implements NestedNameSupport { - + /** * Overriding method of the heart of the matter. Gets the relative property * and leaves the rest up to the original tag implementation. Sweet. @@ -81,37 +82,48 @@ * This is in the hands of the super class. */ public int doStartTag() throws JspException { - - /* singleton tag implementations will need the original property to be - set before running */ - super.setProperty(originalProperty); - - /* let the NestedHelper set the properties it can */ - isNesting = true; - NestedPropertyHelper.setNestedProperties(this); - isNesting = false; - - /* do the tag */ + // get the original properties + originalName = getName(); + originalProperty = getProperty(); + + // request + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + // set the properties + NestedPropertyHelper.setNestedProperties(request, this); + + // let the super do it's thing return super.doStartTag(); } - - /** this is overridden so that properties being set by the JSP page aren't - * written over by those needed by the extension. If the tag instance is - * re-used by the JSP, the tag can set the property back to that set by the - * JSP page. - * - * @param newProperty new property value + + /** + * Complete the processing of the tag. The nested tags here will restore + * all the original value for the tag itself and the nesting context. + * @return int to describe the next step for the JSP processor + * @throws JspException for the bad things JSP's do + */ + public int doEndTag() throws JspException { + // do the super's ending part + int i = super.doEndTag(); + + // reset the properties + setName(originalName); + setProperty(originalProperty); + + // continue + return i; + } + + /** + * Release the tag's resources and reset the values. */ - public void setProperty(String newProperty) { - /* let the real tag do its thang */ - super.setProperty(newProperty); - /* if it's the JSP setting it, remember the value */ - if (!isNesting) { - originalProperty = newProperty; - } + public void release() { + super.release(); + // reset the originals + originalName = null; + originalProperty = null; } - - /* hold original property */ + + /* the usual private member variables */ + private String originalName = null; private String originalProperty = null; - private boolean isNesting = false; } 1.4 +46 -34 jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedGreaterThanTag.java Index: NestedGreaterThanTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedGreaterThanTag.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- NestedGreaterThanTag.java 16 Nov 2002 04:41:28 -0000 1.3 +++ NestedGreaterThanTag.java 28 Feb 2003 05:14:39 -0000 1.4 @@ -6,7 +6,7 @@ * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2001 The Apache Software Foundation. All rights + * Copyright (c) 1999-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -59,6 +59,7 @@ */ package org.apache.struts.taglib.nested.logic; +import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.logic.GreaterThanTag; @@ -73,7 +74,7 @@ * @version $Revision$ $Date$ */ public class NestedGreaterThanTag extends GreaterThanTag implements NestedNameSupport { - + /** * Overriding method of the heart of the matter. Gets the relative property * and leaves the rest up to the original tag implementation. Sweet. @@ -81,37 +82,48 @@ * This is in the hands of the super class. */ public int doStartTag() throws JspException { - - /* singleton tag implementations will need the original property to be - set before running */ - super.setProperty(originalProperty); - - /* let the NestedHelper set the properties it can */ - isNesting = true; - NestedPropertyHelper.setNestedProperties(this); - isNesting = false; - - /* do the tag */ + // get the original properties + originalName = getName(); + originalProperty = getProperty(); + + // request + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + // set the properties + NestedPropertyHelper.setNestedProperties(request, this); + + // let the super do it's thing return super.doStartTag(); } - - /** this is overridden so that properties being set by the JSP page aren't - * written over by those needed by the extension. If the tag instance is - * re-used by the JSP, the tag can set the property back to that set by the - * JSP page. - * - * @param newProperty new property value + + /** + * Complete the processing of the tag. The nested tags here will restore + * all the original value for the tag itself and the nesting context. + * @return int to describe the next step for the JSP processor + * @throws JspException for the bad things JSP's do + */ + public int doEndTag() throws JspException { + // do the super's ending part + int i = super.doEndTag(); + + // reset the properties + setName(originalName); + setProperty(originalProperty); + + // continue + return i; + } + + /** + * Release the tag's resources and reset the values. */ - public void setProperty(String newProperty) { - /* let the real tag do its thang */ - super.setProperty(newProperty); - /* if it's the JSP setting it, remember the value */ - if (!isNesting) { - originalProperty = newProperty; - } + public void release() { + super.release(); + // reset the originals + originalName = null; + originalProperty = null; } - - /* hold original property */ + + /* the usual private member variables */ + private String originalName = null; private String originalProperty = null; - private boolean isNesting = false; } 1.5 +5 -5 jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedIterateTei.java Index: NestedIterateTei.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedIterateTei.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- NestedIterateTei.java 16 Nov 2002 04:41:28 -0000 1.4 +++ NestedIterateTei.java 28 Feb 2003 05:14:39 -0000 1.5 @@ -6,7 +6,7 @@ * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2001 The Apache Software Foundation. All rights + * Copyright (c) 1999-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without 1.4 +46 -34 jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedGreaterEqualTag.java Index: NestedGreaterEqualTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedGreaterEqualTag.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- NestedGreaterEqualTag.java 16 Nov 2002 04:41:28 -0000 1.3 +++ NestedGreaterEqualTag.java 28 Feb 2003 05:14:39 -0000 1.4 @@ -6,7 +6,7 @@ * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2001 The Apache Software Foundation. All rights + * Copyright (c) 1999-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -59,6 +59,7 @@ */ package org.apache.struts.taglib.nested.logic; +import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.logic.GreaterEqualTag; @@ -73,7 +74,7 @@ * @version $Revision$ $Date$ */ public class NestedGreaterEqualTag extends GreaterEqualTag implements NestedNameSupport { - + /** * Overriding method of the heart of the matter. Gets the relative property * and leaves the rest up to the original tag implementation. Sweet. @@ -81,37 +82,48 @@ * This is in the hands of the super class. */ public int doStartTag() throws JspException { - - /* singleton tag implementations will need the original property to be - set before running */ - super.setProperty(originalProperty); - - /* let the NestedHelper set the properties it can */ - isNesting = true; - NestedPropertyHelper.setNestedProperties(this); - isNesting = false; - - /* do the tag */ + // get the original properties + originalName = getName(); + originalProperty = getProperty(); + + // request + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + // set the properties + NestedPropertyHelper.setNestedProperties(request, this); + + // let the super do it's thing return super.doStartTag(); } - - /** this is overridden so that properties being set by the JSP page aren't - * written over by those needed by the extension. If the tag instance is - * re-used by the JSP, the tag can set the property back to that set by the - * JSP page. - * - * @param newProperty new property value + + /** + * Complete the processing of the tag. The nested tags here will restore + * all the original value for the tag itself and the nesting context. + * @return int to describe the next step for the JSP processor + * @throws JspException for the bad things JSP's do + */ + public int doEndTag() throws JspException { + // do the super's ending part + int i = super.doEndTag(); + + // reset the properties + setName(originalName); + setProperty(originalProperty); + + // continue + return i; + } + + /** + * Release the tag's resources and reset the values. */ - public void setProperty(String newProperty) { - /* let the real tag do its thang */ - super.setProperty(newProperty); - /* if it's the JSP setting it, remember the value */ - if (!isNesting) { - originalProperty = newProperty; - } + public void release() { + super.release(); + // reset the originals + originalName = null; + originalProperty = null; } - - /* hold original property */ + + /* the usual private member variables */ + private String originalName = null; private String originalProperty = null; - private boolean isNesting = false; } 1.7 +107 -84 jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedIterateTag.java Index: NestedIterateTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedIterateTag.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- NestedIterateTag.java 16 Nov 2002 04:41:28 -0000 1.6 +++ NestedIterateTag.java 28 Feb 2003 05:14:39 -0000 1.7 @@ -6,7 +6,7 @@ * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2001 The Apache Software Foundation. All rights + * Copyright (c) 1999-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -59,16 +59,13 @@ */ package org.apache.struts.taglib.nested.logic; -import java.util.Map; - +import java.util.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.logic.IterateTag; import org.apache.struts.taglib.nested.NestedNameSupport; -import org.apache.struts.taglib.nested.NestedParentSupport; import org.apache.struts.taglib.nested.NestedPropertyHelper; -import org.apache.struts.taglib.nested.NestedReference; /** * NestedIterateTag. @@ -79,21 +76,7 @@ * @since Struts 1.1 * @version $Revision$ $Date$ */ -public class NestedIterateTag extends IterateTag implements NestedParentSupport, NestedNameSupport { - - - /** - * The only added property to the class. For use in proper nesting. - * @return String value of the property and the current index. - */ - public String getNestedProperty() { - Object idObj = pageContext.getAttribute(id); - if (idObj instanceof Map.Entry) { - return property + "("+ ((Map.Entry)idObj).getKey() +")"; - } else { - return property + "["+ this.getIndex() +"]"; - } - } +public class NestedIterateTag extends IterateTag implements NestedNameSupport { /** * Overriding method of the heart of the matter. Gets the relative property @@ -102,53 +85,57 @@ * This is in the hands of the super class. */ public int doStartTag() throws JspException { - /* singleton tag implementations will need the original property to be - set before running */ - super.setProperty(originalProperty); - - - /* Set the id. Had to be set to the property originally anyways. */ - if (id == null || id.trim().length() <= 0) { - id = property; + // original values + originalName = getName(); + originalProperty = getProperty(); + + // set the ID to make the super tag happy + if (id == null || id.trim().length() == 0) { id = property; } + + // the request object + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + + // original nesting details + originalNesting = NestedPropertyHelper.getCurrentProperty(request); + originalNestingName = NestedPropertyHelper.getCurrentName(request, this); + + // set the bean if it's been provided + // (the bean that's been provided! get it!?... nevermind) + if (getName() == null) { + // the qualified nesting value + nesting = NestedPropertyHelper.getAdjustedProperty(request, getProperty()); + } else { + // it's just the property + nesting = getProperty(); } - - - /* let the NestedHelper set the properties it can */ - isNesting = true; - NestedPropertyHelper.setNestedProperties(this); - isNesting = false; - - - /* get the original result */ + + // set the properties + NestedPropertyHelper.setNestedProperties(request, this); + + // get the original result int temp = super.doStartTag(); - - /* set the include reference */ - HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); - currentReference = new NestedReference(getName(), getNestedProperty()); - originalReference = NestedPropertyHelper.setIncludeReference(request, - currentReference); - - /* return the result */ + + // set the new reference (including the index etc) + NestedPropertyHelper.setName(request, getName()); + NestedPropertyHelper.setProperty(request, deriveNestedProperty()); + + // return the result return temp; } - - /** this is overridden so that properties being set by the JSP page aren't - * written over by those needed by the extension. If the tag instance is - * re-used by the JSP, the tag can set the property back to that set by the - * JSP page. - * - * @param newProperty new property value + + /** + * The only added property to the class. For use in proper nesting. + * @return String value of the property and the current index or mapping. */ - public void setProperty(String newProperty) { - /* let the real tag do its thang */ - super.setProperty(newProperty); - /* if it's the JSP setting it, remember the value */ - if (!isNesting) { - originalProperty = newProperty; + private String deriveNestedProperty() { + Object idObj = pageContext.getAttribute(id); + if (idObj instanceof Map.Entry) { + return nesting + "("+ ((Map.Entry)idObj).getKey() +")"; + } else { + return nesting + "["+ this.getIndex() +"]"; } } - - + /** * This is only overriden as the include reference will need it's index * updated. @@ -156,30 +143,66 @@ * @return int JSP continuation directive. */ public int doAfterBody() throws JspException { - /* store original result */ + // store original result int temp = super.doAfterBody(); - + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); if (temp != SKIP_BODY) { - /* set the new reference */ - currentReference.setNestedProperty(getNestedProperty()); - } else { - /* all done. clean up */ - currentReference = null; - - HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); - NestedPropertyHelper.setIncludeReference(request, originalReference); - originalReference = null; + // set the new reference + NestedPropertyHelper.setProperty(request, deriveNestedProperty()); } - - /* return super result */ + // return super result return temp; } - - /* hold original property */ + + /** + * Complete the processing of the tag. The nested tags here will restore + * all the original value for the tag itself and the nesting context. + * @return int to describe the next step for the JSP processor + * @throws JspException for the bad things JSP's do + */ + public int doEndTag() throws JspException { + // the super's thing + int i = super.doEndTag(); + + // request + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + // reset the original tag values + super.setName(originalName); + super.setProperty(originalProperty); + + // reset the original nesting values + if (originalNesting == null) { + NestedPropertyHelper.deleteReference(request); + } else { + NestedPropertyHelper.setProperty(request, originalNesting); + NestedPropertyHelper.setName(request, originalNestingName); + } + // job done + return i; + } + + /** + * Release the tag's resources and reset the values. + */ + public void release() { + // let the super release + super.release(); + // reset the original value place holders + originalName = null; + originalProperty = null; + originalNesting = null; + originalNestingName = null; + } + + + // The current nesting + private String nesting = null; + + // original tag properties + private String originalName = null; private String originalProperty = null; - private boolean isNesting = false; - - /* includes nested references */ - private NestedReference originalReference; - private NestedReference currentReference; + + // original nesting environment + private String originalNesting = null; + private String originalNestingName = null; } 1.4 +49 -36 jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedMessagesNotPresentTag.java Index: NestedMessagesNotPresentTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedMessagesNotPresentTag.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- NestedMessagesNotPresentTag.java 16 Nov 2002 04:41:28 -0000 1.3 +++ NestedMessagesNotPresentTag.java 28 Feb 2003 05:14:39 -0000 1.4 @@ -6,7 +6,7 @@ * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2001 The Apache Software Foundation. All rights + * Copyright (c) 1999-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -59,11 +59,12 @@ */ package org.apache.struts.taglib.nested.logic; +import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.logic.MessagesNotPresentTag; +import org.apache.struts.taglib.nested.NestedNameSupport; import org.apache.struts.taglib.nested.NestedPropertyHelper; -import org.apache.struts.taglib.nested.NestedPropertySupport; /** * NestedMessagesNotPresentTag. @@ -73,8 +74,9 @@ * @since Struts 1.1 * @version $Revision$ $Date$ */ -public class NestedMessagesNotPresentTag extends MessagesNotPresentTag implements NestedPropertySupport { - +public class NestedMessagesNotPresentTag extends MessagesNotPresentTag + implements NestedNameSupport { + /** * Overriding method of the heart of the matter. Gets the relative property * and leaves the rest up to the original tag implementation. Sweet. @@ -82,37 +84,48 @@ * This is in the hands of the super class. */ public int doStartTag() throws JspException { - - /* singleton tag implementations will need the original property to be - set before running */ - super.setProperty(originalProperty); - - /* let the NestedHelper set the properties it can */ - isNesting = true; - NestedPropertyHelper.setNestedProperties(this); - isNesting = false; - - /* do the tag */ + // get the original properties + originalName = getName(); + originalProperty = getProperty(); + + // request + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + // set the properties + NestedPropertyHelper.setNestedProperties(request, this); + + // let the super do it's thing return super.doStartTag(); } - - /** this is overridden so that properties being set by the JSP page aren't - * written over by those needed by the extension. If the tag instance is - * re-used by the JSP, the tag can set the property back to that set by the - * JSP page. - * - * @param newProperty new property value + + /** + * Complete the processing of the tag. The nested tags here will restore + * all the original value for the tag itself and the nesting context. + * @return int to describe the next step for the JSP processor + * @throws JspException for the bad things JSP's do + */ + public int doEndTag() throws JspException { + // do the super's ending part + int i = super.doEndTag(); + + // reset the properties + setName(originalName); + setProperty(originalProperty); + + // continue + return i; + } + + /** + * Release the tag's resources and reset the values. */ - public void setProperty(String newProperty) { - /* let the real tag do its thang */ - super.setProperty(newProperty); - /* if it's the JSP setting it, remember the value */ - if (!isNesting) { - originalProperty = newProperty; - } + public void release() { + super.release(); + // reset the originals + originalName = null; + originalProperty = null; } - - /* hold original property */ + + /* the usual private member variables */ + private String originalName = null; private String originalProperty = null; - private boolean isNesting = false; } 1.4 +46 -34 jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedMatchTag.java Index: NestedMatchTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedMatchTag.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- NestedMatchTag.java 16 Nov 2002 04:41:28 -0000 1.3 +++ NestedMatchTag.java 28 Feb 2003 05:14:39 -0000 1.4 @@ -6,7 +6,7 @@ * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2001 The Apache Software Foundation. All rights + * Copyright (c) 1999-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -59,6 +59,7 @@ */ package org.apache.struts.taglib.nested.logic; +import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.logic.MatchTag; @@ -73,7 +74,7 @@ * @version $Revision$ $Date$ */ public class NestedMatchTag extends MatchTag implements NestedNameSupport { - + /** * Overriding method of the heart of the matter. Gets the relative property * and leaves the rest up to the original tag implementation. Sweet. @@ -81,37 +82,48 @@ * This is in the hands of the super class. */ public int doStartTag() throws JspException { - - /* singleton tag implementations will need the original property to be - set before running */ - super.setProperty(originalProperty); - - /* let the NestedHelper set the properties it can */ - isNesting = true; - NestedPropertyHelper.setNestedProperties(this); - isNesting = false; - - /* do the tag */ + // get the original properties + originalName = getName(); + originalProperty = getProperty(); + + // request + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + // set the properties + NestedPropertyHelper.setNestedProperties(request, this); + + // let the super do it's thing return super.doStartTag(); } - - /** this is overridden so that properties being set by the JSP page aren't - * written over by those needed by the extension. If the tag instance is - * re-used by the JSP, the tag can set the property back to that set by the - * JSP page. - * - * @param newProperty new property value + + /** + * Complete the processing of the tag. The nested tags here will restore + * all the original value for the tag itself and the nesting context. + * @return int to describe the next step for the JSP processor + * @throws JspException for the bad things JSP's do + */ + public int doEndTag() throws JspException { + // do the super's ending part + int i = super.doEndTag(); + + // reset the properties + setName(originalName); + setProperty(originalProperty); + + // continue + return i; + } + + /** + * Release the tag's resources and reset the values. */ - public void setProperty(String newProperty) { - /* let the real tag do its thang */ - super.setProperty(newProperty); - /* if it's the JSP setting it, remember the value */ - if (!isNesting) { - originalProperty = newProperty; - } + public void release() { + super.release(); + // reset the originals + originalName = null; + originalProperty = null; } - - /* hold original property */ + + /* the usual private member variables */ + private String originalName = null; private String originalProperty = null; - private boolean isNesting = false; } 1.4 +46 -34 jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedLessThanTag.java Index: NestedLessThanTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedLessThanTag.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- NestedLessThanTag.java 16 Nov 2002 04:41:28 -0000 1.3 +++ NestedLessThanTag.java 28 Feb 2003 05:14:39 -0000 1.4 @@ -6,7 +6,7 @@ * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2001 The Apache Software Foundation. All rights + * Copyright (c) 1999-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -59,6 +59,7 @@ */ package org.apache.struts.taglib.nested.logic; +import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.logic.LessThanTag; @@ -73,7 +74,7 @@ * @version $Revision$ $Date$ */ public class NestedLessThanTag extends LessThanTag implements NestedNameSupport { - + /** * Overriding method of the heart of the matter. Gets the relative property * and leaves the rest up to the original tag implementation. Sweet. @@ -81,37 +82,48 @@ * This is in the hands of the super class. */ public int doStartTag() throws JspException { - - /* singleton tag implementations will need the original property to be - set before running */ - super.setProperty(originalProperty); - - /* let the NestedHelper set the properties it can */ - isNesting = true; - NestedPropertyHelper.setNestedProperties(this); - isNesting = false; - - /* do the tag */ + // get the original properties + originalName = getName(); + originalProperty = getProperty(); + + // request + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + // set the properties + NestedPropertyHelper.setNestedProperties(request, this); + + // let the super do it's thing return super.doStartTag(); } - - /** this is overridden so that properties being set by the JSP page aren't - * written over by those needed by the extension. If the tag instance is - * re-used by the JSP, the tag can set the property back to that set by the - * JSP page. - * - * @param newProperty new property value + + /** + * Complete the processing of the tag. The nested tags here will restore + * all the original value for the tag itself and the nesting context. + * @return int to describe the next step for the JSP processor + * @throws JspException for the bad things JSP's do + */ + public int doEndTag() throws JspException { + // do the super's ending part + int i = super.doEndTag(); + + // reset the properties + setName(originalName); + setProperty(originalProperty); + + // continue + return i; + } + + /** + * Release the tag's resources and reset the values. */ - public void setProperty(String newProperty) { - /* let the real tag do its thang */ - super.setProperty(newProperty); - /* if it's the JSP setting it, remember the value */ - if (!isNesting) { - originalProperty = newProperty; - } + public void release() { + super.release(); + // reset the originals + originalName = null; + originalProperty = null; } - - /* hold original property */ + + /* the usual private member variables */ + private String originalName = null; private String originalProperty = null; - private boolean isNesting = false; } 1.4 +46 -34 jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedPresentTag.java Index: NestedPresentTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedPresentTag.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- NestedPresentTag.java 16 Nov 2002 04:41:28 -0000 1.3 +++ NestedPresentTag.java 28 Feb 2003 05:14:39 -0000 1.4 @@ -6,7 +6,7 @@ * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2001 The Apache Software Foundation. All rights + * Copyright (c) 1999-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -59,6 +59,7 @@ */ package org.apache.struts.taglib.nested.logic; +import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.logic.PresentTag; @@ -73,7 +74,7 @@ * @version $Revision$ $Date$ */ public class NestedPresentTag extends PresentTag implements NestedNameSupport { - + /** * Overriding method of the heart of the matter. Gets the relative property * and leaves the rest up to the original tag implementation. Sweet. @@ -81,37 +82,48 @@ * This is in the hands of the super class. */ public int doStartTag() throws JspException { - - /* singleton tag implementations will need the original property to be - set before running */ - super.setProperty(originalProperty); - - /* let the NestedHelper set the properties it can */ - isNesting = true; - NestedPropertyHelper.setNestedProperties(this); - isNesting = false; - - /* do the tag */ + // get the original properties + originalName = getName(); + originalProperty = getProperty(); + + // request + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + // set the properties + NestedPropertyHelper.setNestedProperties(request, this); + + // let the super do it's thing return super.doStartTag(); } - - /** this is overridden so that properties being set by the JSP page aren't - * written over by those needed by the extension. If the tag instance is - * re-used by the JSP, the tag can set the property back to that set by the - * JSP page. - * - * @param newProperty new property value + + /** + * Complete the processing of the tag. The nested tags here will restore + * all the original value for the tag itself and the nesting context. + * @return int to describe the next step for the JSP processor + * @throws JspException for the bad things JSP's do + */ + public int doEndTag() throws JspException { + // do the super's ending part + int i = super.doEndTag(); + + // reset the properties + setName(originalName); + setProperty(originalProperty); + + // continue + return i; + } + + /** + * Release the tag's resources and reset the values. */ - public void setProperty(String newProperty) { - /* let the real tag do its thang */ - super.setProperty(newProperty); - /* if it's the JSP setting it, remember the value */ - if (!isNesting) { - originalProperty = newProperty; - } + public void release() { + super.release(); + // reset the originals + originalName = null; + originalProperty = null; } - - /* hold original property */ + + /* the usual private member variables */ + private String originalName = null; private String originalProperty = null; - private boolean isNesting = false; } 1.4 +46 -34 jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedNotMatchTag.java Index: NestedNotMatchTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedNotMatchTag.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- NestedNotMatchTag.java 16 Nov 2002 04:41:28 -0000 1.3 +++ NestedNotMatchTag.java 28 Feb 2003 05:14:39 -0000 1.4 @@ -6,7 +6,7 @@ * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2001 The Apache Software Foundation. All rights + * Copyright (c) 1999-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -59,6 +59,7 @@ */ package org.apache.struts.taglib.nested.logic; +import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.logic.NotMatchTag; @@ -73,7 +74,7 @@ * @version $Revision$ $Date$ */ public class NestedNotMatchTag extends NotMatchTag implements NestedNameSupport { - + /** * Overriding method of the heart of the matter. Gets the relative property * and leaves the rest up to the original tag implementation. Sweet. @@ -81,37 +82,48 @@ * This is in the hands of the super class. */ public int doStartTag() throws JspException { - - /* singleton tag implementations will need the original property to be - set before running */ - super.setProperty(originalProperty); - - /* let the NestedHelper set the properties it can */ - isNesting = true; - NestedPropertyHelper.setNestedProperties(this); - isNesting = false; - - /* do the tag */ + // get the original properties + originalName = getName(); + originalProperty = getProperty(); + + // request + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + // set the properties + NestedPropertyHelper.setNestedProperties(request, this); + + // let the super do it's thing return super.doStartTag(); } - - /** this is overridden so that properties being set by the JSP page aren't - * written over by those needed by the extension. If the tag instance is - * re-used by the JSP, the tag can set the property back to that set by the - * JSP page. - * - * @param newProperty new property value + + /** + * Complete the processing of the tag. The nested tags here will restore + * all the original value for the tag itself and the nesting context. + * @return int to describe the next step for the JSP processor + * @throws JspException for the bad things JSP's do + */ + public int doEndTag() throws JspException { + // do the super's ending part + int i = super.doEndTag(); + + // reset the properties + setName(originalName); + setProperty(originalProperty); + + // continue + return i; + } + + /** + * Release the tag's resources and reset the values. */ - public void setProperty(String newProperty) { - /* let the real tag do its thang */ - super.setProperty(newProperty); - /* if it's the JSP setting it, remember the value */ - if (!isNesting) { - originalProperty = newProperty; - } + public void release() { + super.release(); + // reset the originals + originalName = null; + originalProperty = null; } - - /* hold original property */ + + /* the usual private member variables */ + private String originalName = null; private String originalProperty = null; - private boolean isNesting = false; } 1.4 +49 -36 jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedMessagesPresentTag.java Index: NestedMessagesPresentTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedMessagesPresentTag.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- NestedMessagesPresentTag.java 16 Nov 2002 04:41:28 -0000 1.3 +++ NestedMessagesPresentTag.java 28 Feb 2003 05:14:39 -0000 1.4 @@ -6,7 +6,7 @@ * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2001 The Apache Software Foundation. All rights + * Copyright (c) 1999-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -59,11 +59,12 @@ */ package org.apache.struts.taglib.nested.logic; +import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.logic.MessagesPresentTag; +import org.apache.struts.taglib.nested.NestedNameSupport; import org.apache.struts.taglib.nested.NestedPropertyHelper; -import org.apache.struts.taglib.nested.NestedPropertySupport; /** * NestedMessagesPresentTag. @@ -73,8 +74,9 @@ * @since Struts 1.1 * @version $Revision$ $Date$ */ -public class NestedMessagesPresentTag extends MessagesPresentTag implements NestedPropertySupport { - +public class NestedMessagesPresentTag extends MessagesPresentTag + implements NestedNameSupport { + /** * Overriding method of the heart of the matter. Gets the relative property * and leaves the rest up to the original tag implementation. Sweet. @@ -82,37 +84,48 @@ * This is in the hands of the super class. */ public int doStartTag() throws JspException { - - /* singleton tag implementations will need the original property to be - set before running */ - super.setProperty(originalProperty); - - /* let the NestedHelper set the properties it can */ - isNesting = true; - NestedPropertyHelper.setNestedProperties(this); - isNesting = false; - - /* do the tag */ + // get the original properties + originalName = getName(); + originalProperty = getProperty(); + + // request + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + // set the properties + NestedPropertyHelper.setNestedProperties(request, this); + + // let the super do it's thing return super.doStartTag(); } - - /** this is overridden so that properties being set by the JSP page aren't - * written over by those needed by the extension. If the tag instance is - * re-used by the JSP, the tag can set the property back to that set by the - * JSP page. - * - * @param newProperty new property value + + /** + * Complete the processing of the tag. The nested tags here will restore + * all the original value for the tag itself and the nesting context. + * @return int to describe the next step for the JSP processor + * @throws JspException for the bad things JSP's do + */ + public int doEndTag() throws JspException { + // do the super's ending part + int i = super.doEndTag(); + + // reset the properties + setName(originalName); + setProperty(originalProperty); + + // continue + return i; + } + + /** + * Release the tag's resources and reset the values. */ - public void setProperty(String newProperty) { - /* let the real tag do its thang */ - super.setProperty(newProperty); - /* if it's the JSP setting it, remember the value */ - if (!isNesting) { - originalProperty = newProperty; - } + public void release() { + super.release(); + // reset the originals + originalName = null; + originalProperty = null; } - - /* hold original property */ + + /* the usual private member variables */ + private String originalName = null; private String originalProperty = null; - private boolean isNesting = false; } 1.4 +46 -34 jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedNotEqualTag.java Index: NestedNotEqualTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedNotEqualTag.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- NestedNotEqualTag.java 16 Nov 2002 04:41:28 -0000 1.3 +++ NestedNotEqualTag.java 28 Feb 2003 05:14:39 -0000 1.4 @@ -6,7 +6,7 @@ * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2001 The Apache Software Foundation. All rights + * Copyright (c) 1999-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -59,6 +59,7 @@ */ package org.apache.struts.taglib.nested.logic; +import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.logic.NotEqualTag; @@ -73,7 +74,7 @@ * @version $Revision$ $Date$ */ public class NestedNotEqualTag extends NotEqualTag implements NestedNameSupport { - + /** * Overriding method of the heart of the matter. Gets the relative property * and leaves the rest up to the original tag implementation. Sweet. @@ -81,37 +82,48 @@ * This is in the hands of the super class. */ public int doStartTag() throws JspException { - - /* singleton tag implementations will need the original property to be - set before running */ - super.setProperty(originalProperty); - - /* let the NestedHelper set the properties it can */ - isNesting = true; - NestedPropertyHelper.setNestedProperties(this); - isNesting = false; - - /* do the tag */ + // get the original properties + originalName = getName(); + originalProperty = getProperty(); + + // request + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + // set the properties + NestedPropertyHelper.setNestedProperties(request, this); + + // let the super do it's thing return super.doStartTag(); } - - /** this is overridden so that properties being set by the JSP page aren't - * written over by those needed by the extension. If the tag instance is - * re-used by the JSP, the tag can set the property back to that set by the - * JSP page. - * - * @param newProperty new property value + + /** + * Complete the processing of the tag. The nested tags here will restore + * all the original value for the tag itself and the nesting context. + * @return int to describe the next step for the JSP processor + * @throws JspException for the bad things JSP's do + */ + public int doEndTag() throws JspException { + // do the super's ending part + int i = super.doEndTag(); + + // reset the properties + setName(originalName); + setProperty(originalProperty); + + // continue + return i; + } + + /** + * Release the tag's resources and reset the values. */ - public void setProperty(String newProperty) { - /* let the real tag do its thang */ - super.setProperty(newProperty); - /* if it's the JSP setting it, remember the value */ - if (!isNesting) { - originalProperty = newProperty; - } + public void release() { + super.release(); + // reset the originals + originalName = null; + originalProperty = null; } - - /* hold original property */ + + /* the usual private member variables */ + private String originalName = null; private String originalProperty = null; - private boolean isNesting = false; } 1.4 +46 -34 jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedLessEqualTag.java Index: NestedLessEqualTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedLessEqualTag.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- NestedLessEqualTag.java 16 Nov 2002 04:41:28 -0000 1.3 +++ NestedLessEqualTag.java 28 Feb 2003 05:14:39 -0000 1.4 @@ -6,7 +6,7 @@ * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2001 The Apache Software Foundation. All rights + * Copyright (c) 1999-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -59,6 +59,7 @@ */ package org.apache.struts.taglib.nested.logic; +import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.logic.LessEqualTag; @@ -73,7 +74,7 @@ * @version $Revision$ $Date$ */ public class NestedLessEqualTag extends LessEqualTag implements NestedNameSupport { - + /** * Overriding method of the heart of the matter. Gets the relative property * and leaves the rest up to the original tag implementation. Sweet. @@ -81,37 +82,48 @@ * This is in the hands of the super class. */ public int doStartTag() throws JspException { - - /* singleton tag implementations will need the original property to be - set before running */ - super.setProperty(originalProperty); - - /* let the NestedHelper set the properties it can */ - isNesting = true; - NestedPropertyHelper.setNestedProperties(this); - isNesting = false; - - /* do the tag */ + // get the original properties + originalName = getName(); + originalProperty = getProperty(); + + // request + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + // set the properties + NestedPropertyHelper.setNestedProperties(request, this); + + // let the super do it's thing return super.doStartTag(); } - - /** this is overridden so that properties being set by the JSP page aren't - * written over by those needed by the extension. If the tag instance is - * re-used by the JSP, the tag can set the property back to that set by the - * JSP page. - * - * @param newProperty new property value + + /** + * Complete the processing of the tag. The nested tags here will restore + * all the original value for the tag itself and the nesting context. + * @return int to describe the next step for the JSP processor + * @throws JspException for the bad things JSP's do + */ + public int doEndTag() throws JspException { + // do the super's ending part + int i = super.doEndTag(); + + // reset the properties + setName(originalName); + setProperty(originalProperty); + + // continue + return i; + } + + /** + * Release the tag's resources and reset the values. */ - public void setProperty(String newProperty) { - /* let the real tag do its thang */ - super.setProperty(newProperty); - /* if it's the JSP setting it, remember the value */ - if (!isNesting) { - originalProperty = newProperty; - } + public void release() { + super.release(); + // reset the originals + originalName = null; + originalProperty = null; } - - /* hold original property */ + + /* the usual private member variables */ + private String originalName = null; private String originalProperty = null; - private boolean isNesting = false; } 1.4 +46 -34 jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedEmptyTag.java Index: NestedEmptyTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/logic/NestedEmptyTag.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- NestedEmptyTag.java 16 Nov 2002 04:41:28 -0000 1.3 +++ NestedEmptyTag.java 28 Feb 2003 05:14:39 -0000 1.4 @@ -6,7 +6,7 @@ * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2001 The Apache Software Foundation. All rights + * Copyright (c) 1999-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -59,6 +59,7 @@ */ package org.apache.struts.taglib.nested.logic; +import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.logic.EmptyTag; @@ -73,7 +74,7 @@ * @version $Revision$ $Date$ */ public class NestedEmptyTag extends EmptyTag implements NestedNameSupport { - + /** * Overriding method of the heart of the matter. Gets the relative property * and leaves the rest up to the original tag implementation. Sweet. @@ -81,37 +82,48 @@ * This is in the hands of the super class. */ public int doStartTag() throws JspException { - - /* singleton tag implementations will need the original property to be - set before running */ - super.setProperty(originalProperty); - - /* let the NestedHelper set the properties it can */ - isNesting = true; - NestedPropertyHelper.setNestedProperties(this); - isNesting = false; - - /* do the tag */ + // get the original properties + originalName = getName(); + originalProperty = getProperty(); + + // request + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + // set the properties + NestedPropertyHelper.setNestedProperties(request, this); + + // let the super do it's thing return super.doStartTag(); } - - /** this is overridden so that properties being set by the JSP page aren't - * written over by those needed by the extension. If the tag instance is - * re-used by the JSP, the tag can set the property back to that set by the - * JSP page. - * - * @param newProperty new property value + + /** + * Complete the processing of the tag. The nested tags here will restore + * all the original value for the tag itself and the nesting context. + * @return int to describe the next step for the JSP processor + * @throws JspException for the bad things JSP's do + */ + public int doEndTag() throws JspException { + // do the super's ending part + int i = super.doEndTag(); + + // reset the properties + setName(originalName); + setProperty(originalProperty); + + // continue + return i; + } + + /** + * Release the tag's resources and reset the values. */ - public void setProperty(String newProperty) { - /* let the real tag do its thang */ - super.setProperty(newProperty); - /* if it's the JSP setting it, remember the value */ - if (!isNesting) { - originalProperty = newProperty; - } + public void release() { + super.release(); + // reset the originals + originalName = null; + originalProperty = null; } - - /* hold original property */ + + /* the usual private member variables */ + private String originalName = null; private String originalProperty = null; - private boolean isNesting = false; }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]