arron 2002/10/23 10:11:42 Modified: src/share/org/apache/struts/taglib/nested NestedPropertyHelper.java Log: Making the tags keep on ticking even if they weren't supplied with a property property. Bug 11574. Reported and fixed by Steve Byrne Revision Changes Path 1.9 +28 -14 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.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- NestedPropertyHelper.java 10 Sep 2002 16:07:59 -0000 1.8 +++ NestedPropertyHelper.java 23 Oct 2002 17:11:42 -0000 1.9 @@ -153,7 +153,10 @@ * @return String of the fully qualified nesting property */ public static String getNestedProperty(String property, Tag parentTag) { - + + // return if there's nothing to play with. + if (property == null) { return null; } + /* if we're just under a root tag no work required */ if (parentTag instanceof FormTag) { /* don't forget to take care of the relative properties */ @@ -169,14 +172,16 @@ } NestedParentSupport nestedParent = (NestedParentSupport)parentTag; - - /* return dot notated property from the parent */ - if (property.indexOf('/') == -1) { - property = nestedParent.getNestedProperty() +"."+ property; - } else { - property = getRelativeProperty(property,nestedParent.getNestedProperty()); + + if (nestedParent != null) { + /* return dot notated property from the parent */ + if (property.indexOf('/') == -1) { + property = nestedParent.getNestedProperty() +"."+ property; + } else { + property = getRelativeProperty(property,nestedParent.getNestedProperty()); + } } - + /* Some properties may be at the start of their hierarchy */ if (property.startsWith(".")) { return property.substring(1, property.length()); @@ -208,7 +213,16 @@ public static String getNestedNameProperty(NestedTagSupport tag) { Tag namedTag = (Tag)tag; - + + // 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; + } + } + /* loop all parent tags until we get one which gives a reliable bean name */ do { @@ -244,7 +258,7 @@ ((NestedPropertySupport)tag).setProperty(property); /* if the tag implements NestedNameSupport, set the name for the tag also */ - if (tag instanceof NestedNameSupport) { + if (tag instanceof NestedNameSupport && property != null) { String name = getNestedNameProperty(tag); ((NestedNameSupport)tag).setName(name); }
-- To unsubscribe, e-mail: <mailto:struts-dev-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:struts-dev-help@;jakarta.apache.org>