arron 2003/02/27 21:15:07 Modified: src/share/org/apache/struts/taglib/nested/html NestedHiddenTag.java NestedLinkTag.java NestedOptionsCollectionTag.java NestedMessagesTag.java NestedPasswordTag.java NestedErrorsTag.java NestedSelectTag.java NestedOptionsTag.java NestedMultiboxTag.java NestedRadioTag.java NestedCheckboxTag.java NestedTextTag.java NestedFileTag.java NestedFormTag.java NestedImageTag.java NestedSubmitTag.java NestedTextareaTag.java NestedImgTag.java Log: Html 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.5 +42 -30 jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedHiddenTag.java Index: NestedHiddenTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedHiddenTag.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- NestedHiddenTag.java 16 Nov 2002 04:38:36 -0000 1.4 +++ NestedHiddenTag.java 28 Feb 2003 05:15:06 -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 @@ -59,6 +59,7 @@ */ package org.apache.struts.taglib.nested.html; +import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.html.HiddenTag; @@ -80,37 +81,48 @@ * This is in the hands of the super class. */ public int doStartTag() throws JspException { + // get the original properties + originalName = getName(); + originalProperty = getProperty(); + + // request + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + // set the properties + NestedPropertyHelper.setNestedProperties(request, this); - /* 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 */ + // 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.8 +57 -66 jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedLinkTag.java Index: NestedLinkTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedLinkTag.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- NestedLinkTag.java 8 Dec 2002 06:54:51 -0000 1.7 +++ NestedLinkTag.java 28 Feb 2003 05:15:06 -0000 1.8 @@ -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,8 +59,8 @@ */ package org.apache.struts.taglib.nested.html; +import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; -import javax.servlet.jsp.tagext.Tag; import org.apache.struts.taglib.html.LinkTag; import org.apache.struts.taglib.nested.NestedNameSupport; @@ -81,84 +81,75 @@ * This is in the hands of the super class. */ public int doStartTag() throws JspException { + origName = super.getName(); + origProperty = super.getProperty(); + origParamProperty = super.getParamProperty(); /* decide the incoming options. Always two there are */ boolean doProperty = (origProperty != null && origProperty.length() > 0); - boolean doParam = (origParam != null && origParam.length() > 0); + boolean doParam = (origParamProperty != null && origParamProperty.length() > 0); - /* if paramId is the way, set the name according to our bean */ - if (getParamName() == null || "".equals(getParamName().trim())) { - if (doParam) { - setParamName(NestedPropertyHelper.getNestedNameProperty(this)); - } - } - - /* set name */ - if (doProperty) { - super.setName(NestedPropertyHelper.getNestedNameProperty(this)); - } - - /* singleton tag implementations will need the original property to be - set before running */ - if (doProperty) { - super.setProperty(origProperty); - } - if (doParam) { - super.setParamProperty(origParam); - } + // request + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); - /* let the NestedHelper set the properties it can */ - isNesting = true; - Tag pTag = NestedPropertyHelper.getNestingParentTag(this); - - /* set the nested property value */ - if (doProperty) { - setProperty(NestedPropertyHelper.getNestedProperty(getProperty(), pTag)); + boolean hasName = (getName() != null && getName().trim().length() > 0); + String currentName; + if (hasName) { + currentName = getName(); + } else { + currentName = NestedPropertyHelper.getCurrentName(request, this); + } + // set the bean name + super.setName(currentName); + + // set property details + if (doProperty && !hasName) { + super.setProperty(NestedPropertyHelper.getAdjustedProperty(request, origProperty)); } - - /* set the nested version of the paramId */ + // do the param property details if (doParam) { - setParamProperty(NestedPropertyHelper.getNestedProperty(getParamProperty(),pTag)); + super.setName(null); + super.setParamName(currentName); + super.setParamProperty(NestedPropertyHelper.getAdjustedProperty(request, origParamProperty)); } - - isNesting = false; - + /* do the tag */ 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 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) { - origProperty = newProperty; - } + public int doEndTag() throws JspException { + // do the super's ending part + int i = super.doEndTag(); + + // reset the properties + setName(origName); + setProperty(origProperty); + setParamProperty(origParamProperty); + + // continue + return i; } - /** For the same reasons as the above method, we have to remember this - * property to keep things correct here also. - * - * @param newParamProperty new property value + /** + * Release the tag's resources and reset the values. */ - public void setParamProperty(String newParamProperty) { - /* let the real tag do its thang */ - super.setParamProperty(newParamProperty); - /* if it's the JSP setting it, remember the value */ - if (!isNesting) { - origParam = newParamProperty; - } + public void release() { + super.release(); + // reset the originals + origName = null; + origProperty = null; + origParamProperty = null; } + /* hold original property */ + private String origName = null; private String origProperty = null; - private String origParam = null; - private boolean isNesting = false; + private String origParamProperty = null; } 1.4 +44 -32 jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedOptionsCollectionTag.java Index: NestedOptionsCollectionTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedOptionsCollectionTag.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- NestedOptionsCollectionTag.java 16 Nov 2002 04:38:36 -0000 1.3 +++ NestedOptionsCollectionTag.java 28 Feb 2003 05:15:06 -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.html; +import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.html.OptionsCollectionTag; +import org.apache.struts.taglib.nested.NestedNameSupport; import org.apache.struts.taglib.nested.NestedPropertyHelper; -import org.apache.struts.taglib.nested.NestedPropertySupport; /** * NestedOptionsCollectionTag. @@ -72,7 +73,7 @@ * @version $Revision$ */ public class NestedOptionsCollectionTag extends OptionsCollectionTag - implements NestedPropertySupport { + implements NestedNameSupport { /** * Overriding method of the heart of the matter. Gets the relative property @@ -81,37 +82,48 @@ * This is in the hands of the super class. */ public int doStartTag() throws JspException { + // get the original properties + originalName = getName(); + originalProperty = getProperty(); + + // request + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + // set the properties + NestedPropertyHelper.setNestedProperties(request, this); - /* 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 */ + // 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 +44 -32 jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedMessagesTag.java Index: NestedMessagesTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedMessagesTag.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- NestedMessagesTag.java 16 Nov 2002 04:38:36 -0000 1.4 +++ NestedMessagesTag.java 28 Feb 2003 05:15:06 -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 @@ -59,11 +59,12 @@ */ package org.apache.struts.taglib.nested.html; +import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.html.MessagesTag; +import org.apache.struts.taglib.nested.NestedNameSupport; import org.apache.struts.taglib.nested.NestedPropertyHelper; -import org.apache.struts.taglib.nested.NestedPropertySupport; /** * NestedMessagesTag. @@ -72,7 +73,7 @@ * @since Struts 1.1 * @version $Revision$ $Date$ */ -public class NestedMessagesTag extends MessagesTag implements NestedPropertySupport { +public class NestedMessagesTag extends MessagesTag implements NestedNameSupport { /** * Overriding method of the heart of the matter. Gets the relative property @@ -81,37 +82,48 @@ * This is in the hands of the super class. */ public int doStartTag() throws JspException { + // get the original properties + originalName = getName(); + originalProperty = getProperty(); + + // request + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + // set the properties + NestedPropertyHelper.setNestedProperties(request, this); - /* 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 */ + // 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 +42 -30 jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedPasswordTag.java Index: NestedPasswordTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedPasswordTag.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- NestedPasswordTag.java 16 Nov 2002 04:38:36 -0000 1.4 +++ NestedPasswordTag.java 28 Feb 2003 05:15:06 -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 @@ -59,6 +59,7 @@ */ package org.apache.struts.taglib.nested.html; +import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.html.PasswordTag; @@ -80,37 +81,48 @@ * This is in the hands of the super class. */ public int doStartTag() throws JspException { + // get the original properties + originalName = getName(); + originalProperty = getProperty(); + + // request + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + // set the properties + NestedPropertyHelper.setNestedProperties(request, this); - /* 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 */ + // 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 +44 -31 jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedErrorsTag.java Index: NestedErrorsTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedErrorsTag.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- NestedErrorsTag.java 16 Nov 2002 04:38:36 -0000 1.4 +++ NestedErrorsTag.java 28 Feb 2003 05:15:06 -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 @@ -59,11 +59,12 @@ */ package org.apache.struts.taglib.nested.html; +import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.html.ErrorsTag; +import org.apache.struts.taglib.nested.NestedNameSupport; import org.apache.struts.taglib.nested.NestedPropertyHelper; -import org.apache.struts.taglib.nested.NestedPropertySupport; /** * NestedErrorsTag. @@ -72,7 +73,7 @@ * @since Struts 1.1 * @version $Revision$ $Date$ */ -public class NestedErrorsTag extends ErrorsTag implements NestedPropertySupport { +public class NestedErrorsTag extends ErrorsTag implements NestedNameSupport { /** * Overriding method of the heart of the matter. Gets the relative property @@ -81,36 +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; + // get the original properties + originalName = getName(); + originalProperty = getProperty(); + + // request + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + // set the properties + NestedPropertyHelper.setNestedProperties(request, this); - /* do the tag */ + // 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 +42 -30 jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedSelectTag.java Index: NestedSelectTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedSelectTag.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- NestedSelectTag.java 16 Nov 2002 04:38:36 -0000 1.4 +++ NestedSelectTag.java 28 Feb 2003 05:15:06 -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 @@ -59,6 +59,7 @@ */ package org.apache.struts.taglib.nested.html; +import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.html.SelectTag; @@ -80,37 +81,48 @@ * This is in the hands of the super class. */ public int doStartTag() throws JspException { + // get the original properties + originalName = getName(); + originalProperty = getProperty(); + + // request + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + // set the properties + NestedPropertyHelper.setNestedProperties(request, this); - /* 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 */ + // 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.6 +52 -51 jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedOptionsTag.java Index: NestedOptionsTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedOptionsTag.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- NestedOptionsTag.java 16 Nov 2002 04:38:36 -0000 1.5 +++ NestedOptionsTag.java 28 Feb 2003 05:15:06 -0000 1.6 @@ -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,9 +59,10 @@ */ package org.apache.struts.taglib.nested.html; +import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; -import javax.servlet.jsp.tagext.Tag; +import org.apache.struts.taglib.html.Constants; import org.apache.struts.taglib.html.OptionsTag; import org.apache.struts.taglib.nested.NestedNameSupport; import org.apache.struts.taglib.nested.NestedPropertyHelper; @@ -81,66 +82,66 @@ * This is in the hands of the super class. */ public int doStartTag() throws JspException { + // get the original properties + originalName = getName(); + originalProperty = getProperty(); + originalLabelProperty = getLabelProperty(); - /* singleton tag implementations will need the original properties to be - set before running */ - super.setProperty(originalProperty); - super.setLabelProperty(originalLabelProperty); - super.setName(NestedPropertyHelper.getNestedNameProperty(this)); - - /* let the NestedHelper set the properties it can */ - isNesting = true; - Tag pTag = NestedPropertyHelper.getNestingParentTag(this); - setProperty(NestedPropertyHelper.getNestedProperty(getProperty(), pTag)); + // request + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); - /* only set the label property if we're meant to */ + // if we have a label property if (originalLabelProperty != null) { - setLabelProperty(NestedPropertyHelper.getNestedProperty(getLabelProperty(), - pTag)); + // do the label property first + if (getName() == null|| Constants.BEAN_KEY.equals(getName())) { + super.setLabelProperty(NestedPropertyHelper.getAdjustedProperty(request, + originalLabelProperty)); + } else { + super.setLabelProperty(originalLabelProperty); + } } - /* finished setting, properties can be set as per usual. */ - isNesting = false; + // set the other properties + NestedPropertyHelper.setNestedProperties(request, this); - /* do the tag */ + + + // 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 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 int doEndTag() throws JspException { + // do the super's ending part + int i = super.doEndTag(); + + // reset the properties + setName(originalName); + setProperty(originalProperty); + setLabelProperty(originalLabelProperty); + // continue + return i; + } - /** This method is overridden for the same reasons as the - * <code>setProperty()</code> method above. - * - * @param newProperty new value to assign to the "labelProperty" property. + /** + * Release the tag's resources and reset the values. */ - public void setLabelProperty(String newProperty) { - /* let the real tag do its thang */ - super.setLabelProperty(newProperty); - /* if it's the JSP setting it, remember the value */ - if (!isNesting) { - originalLabelProperty = newProperty; - } + public void release() { + super.release(); + // reset the originals + originalName = null; + originalProperty = null; + originalLabelProperty = null; } - - /* hold original property */ + /* the usual private member variables */ + private String originalName = null; private String originalProperty = null; private String originalLabelProperty = null; - private boolean isNesting = false; } 1.5 +42 -30 jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedMultiboxTag.java Index: NestedMultiboxTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedMultiboxTag.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- NestedMultiboxTag.java 16 Nov 2002 04:38:36 -0000 1.4 +++ NestedMultiboxTag.java 28 Feb 2003 05:15:06 -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 @@ -59,6 +59,7 @@ */ package org.apache.struts.taglib.nested.html; +import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.html.MultiboxTag; @@ -80,37 +81,48 @@ * This is in the hands of the super class. */ public int doStartTag() throws JspException { + // get the original properties + originalName = getName(); + originalProperty = getProperty(); + + // request + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + // set the properties + NestedPropertyHelper.setNestedProperties(request, this); - /* 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 */ + // 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 +42 -30 jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedRadioTag.java Index: NestedRadioTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedRadioTag.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- NestedRadioTag.java 16 Nov 2002 04:38:36 -0000 1.4 +++ NestedRadioTag.java 28 Feb 2003 05:15:06 -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 @@ -59,6 +59,7 @@ */ package org.apache.struts.taglib.nested.html; +import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.html.RadioTag; @@ -80,37 +81,48 @@ * This is in the hands of the super class. */ public int doStartTag() throws JspException { + // get the original properties + originalName = getName(); + originalProperty = getProperty(); + + // request + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + // set the properties + NestedPropertyHelper.setNestedProperties(request, this); - /* 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 */ + // 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 +44 -31 jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedCheckboxTag.java Index: NestedCheckboxTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedCheckboxTag.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- NestedCheckboxTag.java 16 Nov 2002 04:38:36 -0000 1.4 +++ NestedCheckboxTag.java 28 Feb 2003 05:15:06 -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 @@ -59,9 +59,11 @@ */ package org.apache.struts.taglib.nested.html; +import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.html.CheckboxTag; +import org.apache.struts.taglib.nested.NestedNameSupport; import org.apache.struts.taglib.nested.NestedPropertyHelper; /** @@ -70,7 +72,7 @@ * @since Struts 1.1 * @version $Revision$ $Date$ */ -public class NestedCheckboxTag extends CheckboxTag implements org.apache.struts.taglib.nested.NestedNameSupport { +public class NestedCheckboxTag extends CheckboxTag implements NestedNameSupport { /** * Overriding method of the heart of the matter. Gets the relative property @@ -79,37 +81,48 @@ * This is in the hands of the super class. */ public int doStartTag() throws JspException { + // get the original properties + originalName = getName(); + originalProperty = getProperty(); + + // request + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + // set the properties + NestedPropertyHelper.setNestedProperties(request, this); - /* 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 */ + // 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 +42 -30 jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedTextTag.java Index: NestedTextTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedTextTag.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- NestedTextTag.java 16 Nov 2002 04:38:36 -0000 1.4 +++ NestedTextTag.java 28 Feb 2003 05:15:06 -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 @@ -59,6 +59,7 @@ */ package org.apache.struts.taglib.nested.html; +import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.html.TextTag; @@ -80,37 +81,48 @@ * This is in the hands of the super class. */ public int doStartTag() throws JspException { + // get the original properties + originalName = getName(); + originalProperty = getProperty(); + + // request + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + // set the properties + NestedPropertyHelper.setNestedProperties(request, this); - /* 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 */ + // 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.3 +44 -32 jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedFileTag.java Index: NestedFileTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedFileTag.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- NestedFileTag.java 16 Nov 2002 04:38:36 -0000 1.2 +++ NestedFileTag.java 28 Feb 2003 05:15:06 -0000 1.3 @@ -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.html; +import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.html.FileTag; +import org.apache.struts.taglib.nested.NestedNameSupport; import org.apache.struts.taglib.nested.NestedPropertyHelper; -import org.apache.struts.taglib.nested.NestedPropertySupport; /** * NestedFileTag. @@ -71,7 +72,7 @@ * @since Struts 1.1 * @version $Revision$ */ -public class NestedFileTag extends FileTag implements NestedPropertySupport { +public class NestedFileTag extends FileTag implements NestedNameSupport { /** * Overriding method of the heart of the matter. Gets the relative property @@ -80,37 +81,48 @@ * This is in the hands of the super class. */ public int doStartTag() throws JspException { + // get the original properties + originalName = getName(); + originalProperty = getProperty(); + + // request + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + // set the properties + NestedPropertyHelper.setNestedProperties(request, this); - /* 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 */ + // 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.9 +47 -23 jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedFormTag.java Index: NestedFormTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedFormTag.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- NestedFormTag.java 16 Nov 2002 04:38:36 -0000 1.8 +++ NestedFormTag.java 28 Feb 2003 05:15:06 -0000 1.9 @@ -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 @@ -63,9 +63,8 @@ import javax.servlet.jsp.JspException; import org.apache.struts.taglib.html.FormTag; -import org.apache.struts.taglib.nested.NestedParentSupport; +import org.apache.struts.taglib.nested.NestedNameSupport; import org.apache.struts.taglib.nested.NestedPropertyHelper; -import org.apache.struts.taglib.nested.NestedReference; /** * NestedFormTag. @@ -73,20 +72,20 @@ * @since Struts 1.1 * @version $Revision$ $Date$ */ -public class NestedFormTag extends FormTag implements NestedParentSupport { +public class NestedFormTag extends FormTag implements NestedNameSupport { /** - * The only added property to the class. For use in proper nesting. - * @return String value of the property and the current index. + * Get the string value of the "property" property. + * @return the property property */ - public String getNestedProperty() { - return ""; - } - public String getProperty() { return ""; } + /** + * Setter for the "property" property + * @param newProperty new value for the property + */ public void setProperty(String newProperty) {} @@ -96,15 +95,19 @@ * @return int JSP continuation directive. */ public int doStartTag() throws JspException { - /* store original result */ + // store original result int temp = super.doStartTag(); - /* set the details */ HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); - NestedReference nr = new NestedReference(getBeanName(), getNestedProperty()); - NestedPropertyHelper.setIncludeReference(request, nr); + // original nesting details + originalNesting = NestedPropertyHelper.getCurrentProperty(request); + originalNestingName = NestedPropertyHelper.getCurrentName(request, this); + + // some new details + NestedPropertyHelper.setProperty(request, null); + NestedPropertyHelper.setName(request, super.getBeanName()); - /* continue */ + // continue return temp; } @@ -113,14 +116,35 @@ * @return int JSP continuation directive. */ public int doEndTag() throws JspException { - /* store original result */ + // super result int temp = super.doEndTag(); - /* all done. clean up */ + // all done. clean up HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); - NestedPropertyHelper.setIncludeReference(request, null); + // reset the original nesting values + if (originalNesting == null) { + NestedPropertyHelper.deleteReference(request); + } else { + NestedPropertyHelper.setProperty(request, originalNesting); + NestedPropertyHelper.setName(request, originalNestingName); + } - /* return super result */ + // return the super result return temp; } + + /** + * Release the tag's resources and reset the values. + */ + public void release() { + // let the super release + super.release(); + // reset the original value place holders + originalNesting = null; + originalNestingName = null; + } + + // original nesting environment + private String originalNesting = null; + private String originalNestingName = null; } 1.5 +35 -29 jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedImageTag.java Index: NestedImageTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedImageTag.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- NestedImageTag.java 16 Nov 2002 04:38:36 -0000 1.4 +++ NestedImageTag.java 28 Feb 2003 05:15:06 -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 @@ -59,6 +59,7 @@ */ package org.apache.struts.taglib.nested.html; +import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.html.ImageTag; @@ -80,37 +81,42 @@ * This is in the hands of the super class. */ public int doStartTag() throws JspException { + // get the original properties + originalProperty = getProperty(); - /* 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; + // request + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + // set the properties + NestedPropertyHelper.setNestedProperties(request, this); - /* do the tag */ + // 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 + 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 + originalProperty = null; } - /* hold original property */ + /* the usual private member variables */ private String originalProperty = null; - private boolean isNesting = false; } 1.5 +35 -29 jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedSubmitTag.java Index: NestedSubmitTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedSubmitTag.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- NestedSubmitTag.java 16 Nov 2002 04:38:36 -0000 1.4 +++ NestedSubmitTag.java 28 Feb 2003 05:15:06 -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 @@ -59,6 +59,7 @@ */ package org.apache.struts.taglib.nested.html; +import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.html.SubmitTag; @@ -80,37 +81,42 @@ * This is in the hands of the super class. */ public int doStartTag() throws JspException { + // get the original properties + originalProperty = getProperty(); - /* 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; + // request + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + // set the properties + NestedPropertyHelper.setNestedProperties(request, this); - /* do the tag */ + // 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 + 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 + originalProperty = null; } - /* hold original property */ + /* the usual private member variables */ private String originalProperty = null; - private boolean isNesting = false; } 1.5 +42 -30 jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedTextareaTag.java Index: NestedTextareaTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedTextareaTag.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- NestedTextareaTag.java 16 Nov 2002 04:38:36 -0000 1.4 +++ NestedTextareaTag.java 28 Feb 2003 05:15:06 -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 @@ -59,6 +59,7 @@ */ package org.apache.struts.taglib.nested.html; +import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.html.TextareaTag; @@ -80,37 +81,48 @@ * This is in the hands of the super class. */ public int doStartTag() throws JspException { + // get the original properties + originalName = getName(); + originalProperty = getProperty(); + + // request + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + // set the properties + NestedPropertyHelper.setNestedProperties(request, this); - /* 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 */ + // 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.3 +44 -32 jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedImgTag.java Index: NestedImgTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/html/NestedImgTag.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- NestedImgTag.java 16 Nov 2002 04:38:36 -0000 1.2 +++ NestedImgTag.java 28 Feb 2003 05:15:06 -0000 1.3 @@ -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.html; +import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; import org.apache.struts.taglib.html.ImgTag; +import org.apache.struts.taglib.nested.NestedNameSupport; import org.apache.struts.taglib.nested.NestedPropertyHelper; -import org.apache.struts.taglib.nested.NestedPropertySupport; /** * NestedImgTag, renders the nested version of the <img> tag. @@ -72,7 +73,7 @@ * @since Struts 1.1 * @version $Revision$ */ -public class NestedImgTag extends ImgTag implements NestedPropertySupport { +public class NestedImgTag extends ImgTag implements NestedNameSupport { /** * Overriding method of the heart of the matter. Gets the relative property @@ -81,37 +82,48 @@ * This is in the hands of the super class. */ public int doStartTag() throws JspException { + // get the original properties + originalName = getName(); + originalProperty = getProperty(); + + // request + HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); + // set the properties + NestedPropertyHelper.setNestedProperties(request, this); - /* 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 */ + // 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]