I think it should follow jstl:set and accept body content as a value (raw
text, not ognl I mean).

It's useful to grab some content, put it in attribute, and then look for it
when you're doing sitemesh decorator for example.

Here goes the patch. I'll post it into jira as soon as it's back.

-- Mike

Index: SetTag.java
===================================================================
RCS file:
/cvs/webwork/src/java/com/opensymphony/webwork/views/jsp/SetTag.java,v
retrieving revision 1.2
diff -u -r1.2 SetTag.java
--- SetTag.java 18 Sep 2003 01:38:55 -0000 1.2
+++ SetTag.java 20 Oct 2003 18:53:16 -0000
@@ -7,7 +7,7 @@
 import com.opensymphony.xwork.ActionContext;

 import javax.servlet.jsp.JspException;
-import javax.servlet.jsp.tagext.TagSupport;
+import javax.servlet.jsp.tagext.BodyTagSupport;


 /**
@@ -16,7 +16,7 @@
  * @author $Author: cameronbraid $
  * @version $Revision: 1.2 $
  */
-public class SetTag extends TagSupport {
+public class SetTag extends BodyTagSupport {
     //~ Instance fields
////////////////////////////////////////////////////////

     String name;
@@ -37,17 +37,22 @@
         this.value = value;
     }

-    public int doStartTag() throws JspException {
+    public int doAfterBody() throws JspException {
         Object o;

         if (value != null) {
             o =
ActionContext.getContext().getValueStack().findValue(value);
         } else {
-            o =
ActionContext.getContext().getValueStack().getRoot().peek();
+            String strValue = this.bodyContent.getString();
+            if( strValue != null && strValue.length()>0 ) {
+              o = strValue;
+            } else {
+             o =
ActionContext.getContext().getValueStack().getRoot().peek();
+            }
         }

         if ("application".equals(scope)) {
-            super.pageContext.getServletContext().setAttribute(name, o);
+            pageContext.getServletContext().setAttribute(name, o);
         } else if ("session".equals(scope)) {
             pageContext.getSession().setAttribute(name, o);
         } else if ("request".equals(scope)) {






-------------------------------------------------------
This SF.net email is sponsored by OSDN developer relations
Here's your chance to show off your extensive product knowledge
We want to know what you know. Tell us and you have a chance to win $100
http://www.zoomerang.com/survey.zgi?HRPT1X3RYQNC5V4MLNSV3E54
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to