You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by ap...@apache.org on 2006/11/06 16:29:43 UTC
svn commit: r471763 -
/struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/taglib/AttributeTag.java
Author: apetrelli
Date: Mon Nov 6 07:29:43 2006
New Revision: 471763
URL: http://svn.apache.org/viewvc?view=rev&rev=471763
Log:
Re-put part of attribute preprocessing, though it misses definition resolution (put a FIXME comment for it).
Modified:
struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/taglib/AttributeTag.java
Modified: struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/taglib/AttributeTag.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/taglib/AttributeTag.java?view=diff&rev=471763&r1=471762&r2=471763
==============================================================================
--- struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/taglib/AttributeTag.java (original)
+++ struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/taglib/AttributeTag.java Mon Nov 6 07:29:43 2006
@@ -109,7 +109,7 @@
}
private String calculateType(ComponentAttribute attr) throws JspException {
- String type = attr.getType();
+ String type = attr.getType();
if (type == null) {
Object valueContent = attr.getValue();
if (valueContent instanceof String) {
@@ -119,6 +119,7 @@
} else {
if (container.isValidDefinition(pageContext, valueString)) {
type = ComponentAttribute.DEFINITION;
+ attr.setValue(valueString);
} else {
type = ComponentAttribute.STRING;
}
@@ -128,6 +129,18 @@
throw new JspException("Unrecognized type for attribute value "
+ attr.getValue());
}
+ attr.setType(type);
+ } else if (type.equalsIgnoreCase("definition")) {
+ Object valueContent = attr.getValue();
+ if (valueContent instanceof String) {
+ // FIXME If the value is the name of a definition, the
+ // corresponding definition should be put as the value of the
+ // attribute
+ if (!container.isValidDefinition(pageContext, (String) valueContent))
+ throw new JspException("Cannot find any definition named '"
+ + valueContent + "'");
+ }
+ attr.setValue(valueContent);
}
return type;
}