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/06 01:26:11 UTC
cvs commit: jakarta-struts/src/share/org/apache/struts/taglib/nested NestedPropertyHelper.java
arron 2003/02/05 16:26:11
Modified: src/share/org/apache/struts/taglib/nested
NestedPropertyHelper.java
Log:
Committed patch Bug15799, reported and patched by David Morris.
IDEA also told me to remove a redundant class cast
( ...a fashionable thing to do it seems :)
Revision Changes Path
1.12 +19 -11 jakarta-struts/src/share/org/apache/struts/taglib/nested/NestedPropertyHelper.java
Index: NestedPropertyHelper.java
===================================================================
RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/nested/NestedPropertyHelper.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- NestedPropertyHelper.java 16 Nov 2002 07:07:07 -0000 1.11
+++ NestedPropertyHelper.java 6 Feb 2003 00:26:11 -0000 1.12
@@ -65,6 +65,7 @@
import javax.servlet.jsp.tagext.Tag;
import org.apache.struts.taglib.html.FormTag;
+import org.apache.struts.taglib.html.Constants;
/** A simple helper class that does everything that needs to be done to get the
* nested tag extension to work. Knowing what tags can define the lineage of
@@ -209,14 +210,18 @@
public static String getNestedNameProperty(NestedTagSupport tag) {
Tag namedTag = (Tag)tag;
-
+ String defaultName = null;
// see if we're already in the right location
if (namedTag instanceof NestedNameSupport) {
String name = ((NestedNameSupport)namedTag).getName();
- // return if we already have a name
- if (name != null) {
- return name;
- }
+ // return if we already have a name and not just default
+ if (name != null) {
+ if (name.equals(Constants.BEAN_KEY)) {
+ defaultName = name;
+ } else {
+ return name;
+ }
+ }
}
/* loop all parent tags until we get one which
@@ -228,7 +233,10 @@
!(namedTag instanceof NestedParentSupport) );
if (namedTag == null) {
- // need to spit some chips
+ if (defaultName != null) {
+ return defaultName;
+ }
+ // now there's an issue
}
String nameTemp = null;
@@ -251,7 +259,7 @@
/* get and set the relative property */
String property = getNestedProperty(tag);
- ((NestedPropertySupport)tag).setProperty(property);
+ tag.setProperty(property);
/* if the tag implements NestedNameSupport, set the name for the tag also */
if (tag instanceof NestedNameSupport && property != null) {
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org