You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by ar...@apache.org on 2003/02/28 06:15:37 UTC
cvs commit: jakarta-struts/src/share/org/apache/struts/taglib/nested/bean NestedSizeTag.java NestedWriteTag.java NestedMessageTag.java NestedDefineTag.java
arron 2003/02/27 21:15:37
Modified: src/share/org/apache/struts/taglib/nested/bean
NestedSizeTag.java NestedWriteTag.java
NestedMessageTag.java NestedDefineTag.java
Log:
Bean 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 +45 -33 jakarta-struts/src/share/org/apache/struts/taglib/nested/bean/NestedSizeTag.java
Index: NestedSizeTag.java
===================================================================
RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/bean/NestedSizeTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- NestedSizeTag.java 16 Nov 2002 04:32:38 -0000 1.3
+++ NestedSizeTag.java 28 Feb 2003 05:15:36 -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.bean;
+import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import org.apache.struts.taglib.bean.SizeTag;
@@ -80,37 +81,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 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);
+
+ // continue
+ return i;
}
-
- /* hold original property */
+
+ /**
+ * Release the tag's resources and reset the values.
+ */
+ public void release() {
+ super.release();
+ // reset the originals
+ originalName = null;
+ originalProperty = null;
+ }
+
+ /* the usual private member variables */
+ private String originalName = null;
private String originalProperty = null;
- private boolean isNesting = false;
}
1.4 +45 -33 jakarta-struts/src/share/org/apache/struts/taglib/nested/bean/NestedWriteTag.java
Index: NestedWriteTag.java
===================================================================
RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/bean/NestedWriteTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- NestedWriteTag.java 16 Nov 2002 04:32:38 -0000 1.3
+++ NestedWriteTag.java 28 Feb 2003 05:15:36 -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.bean;
+import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import org.apache.struts.taglib.bean.WriteTag;
@@ -80,37 +81,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 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);
+
+ // continue
+ return i;
}
-
- /* hold original property */
+
+ /**
+ * Release the tag's resources and reset the values.
+ */
+ public void release() {
+ super.release();
+ // reset the originals
+ originalName = null;
+ originalProperty = null;
+ }
+
+ /* the usual private member variables */
+ private String originalName = null;
private String originalProperty = null;
- private boolean isNesting = false;
}
1.3 +45 -33 jakarta-struts/src/share/org/apache/struts/taglib/nested/bean/NestedMessageTag.java
Index: NestedMessageTag.java
===================================================================
RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/bean/NestedMessageTag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- NestedMessageTag.java 16 Nov 2002 04:32:38 -0000 1.2
+++ NestedMessageTag.java 28 Feb 2003 05:15:36 -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,6 +59,7 @@
*/
package org.apache.struts.taglib.nested.bean;
+import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import org.apache.struts.taglib.bean.MessageTag;
@@ -80,37 +81,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 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);
+
+ // continue
+ return i;
}
-
- /* hold original property */
+
+ /**
+ * Release the tag's resources and reset the values.
+ */
+ public void release() {
+ super.release();
+ // reset the originals
+ originalName = null;
+ originalProperty = null;
+ }
+
+ /* the usual private member variables */
+ private String originalName = null;
private String originalProperty = null;
- private boolean isNesting = false;
}
1.4 +45 -33 jakarta-struts/src/share/org/apache/struts/taglib/nested/bean/NestedDefineTag.java
Index: NestedDefineTag.java
===================================================================
RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/bean/NestedDefineTag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- NestedDefineTag.java 16 Nov 2002 04:32:38 -0000 1.3
+++ NestedDefineTag.java 28 Feb 2003 05:15:36 -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.bean;
+import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import org.apache.struts.taglib.bean.DefineTag;
@@ -80,37 +81,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 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);
+
+ // continue
+ return i;
}
-
- /* hold original property */
+
+ /**
+ * Release the tag's resources and reset the values.
+ */
+ public void release() {
+ super.release();
+ // reset the originals
+ originalName = null;
+ originalProperty = null;
+ }
+
+ /* the usual private member variables */
+ private String originalName = null;
private String originalProperty = null;
- private boolean isNesting = false;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org