oalexeev 02/02/25 12:56:53
Modified: src/share/org/apache/struts/taglib/bean DefineTag.java
LocalStrings.properties
Log:
Patch for tag body processing.
Source - "Robson Miranda" <[EMAIL PROTECTED]>
Revision Changes Path
1.14 +23 -7
jakarta-struts/src/share/org/apache/struts/taglib/bean/DefineTag.java
Index: DefineTag.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/DefineTag.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- DefineTag.java 21 Feb 2002 17:48:14 -0000 1.13
+++ DefineTag.java 25 Feb 2002 20:56:53 -0000 1.14
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/DefineTag.java,v 1.13
2002/02/21 17:48:14 oalexeev Exp $
- * $Revision: 1.13 $
- * $Date: 2002/02/21 17:48:14 $
+ * $Header:
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/DefineTag.java,v 1.14
2002/02/25 20:56:53 oalexeev Exp $
+ * $Revision: 1.14 $
+ * $Date: 2002/02/25 20:56:53 $
*
* ====================================================================
*
@@ -77,7 +77,7 @@
* bean property.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.13 $ $Date: 2002/02/21 17:48:14 $
+ * @version $Revision: 1.14 $ $Date: 2002/02/25 20:56:53 $
*/
public class DefineTag extends BodyTagSupport {
@@ -196,21 +196,37 @@
// --------------------------------------------------------- Public Methods
/**
+ *
+ * Check if we need to evaluate the body of the tag
+ *
+ * @exception JspException if a JSP exception has occurred
+ */
+ public int doStartTag() throws JspException {
+
+ if( this.name!=null || this.value!=null )
+ return (SKIP_BODY);
+ else
+ return (EVAL_BODY_BUFFERED);
+ }
+
+ /**
* Retrieve the required property and expose it as a scripting variable.
*
* @exception JspException if a JSP exception has occurred
*/
public int doEndTag() throws JspException {
- if( this.value!=null && bodyContent!=null )
+ if( ( this.value!=null ||
+ this.name!=null ) &&
+ bodyContent!=null )
throw new JspException( messages.getMessage("define.value", name) );
// Retrieve the required property value
Object value = this.value;
+ if (value == null && name!=null)
+ value = RequestUtils.lookup(pageContext, name, property, scope);
if (value == null)
value = bodyContent.getString();
- if (value == null)
- value = RequestUtils.lookup(pageContext, name, property, scope);
// Expose this value as a scripting variable
int inScope = PageContext.PAGE_SCOPE;
1.16 +1 -1
jakarta-struts/src/share/org/apache/struts/taglib/bean/LocalStrings.properties
Index: LocalStrings.properties
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/LocalStrings.properties,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- LocalStrings.properties 21 Feb 2002 17:48:14 -0000 1.15
+++ LocalStrings.properties 25 Feb 2002 20:56:53 -0000 1.16
@@ -17,4 +17,4 @@
struts.missing=No Struts internal object named {0} is available
struts.selector=You must specify exactly one of formBean, forward, or mapping
write.format=Wrong format string: '{0}'
-define.value=Define tag can contain value attribute or body - both can not be
processed.
\ No newline at end of file
+define.value=Define tag can contain value/name attributes or body.
\ No newline at end of file
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>