webwork/src/main/webwork/view/taglib WebWorkBodyTagSupport.java,1.6,1.7

[email protected] Sat, 29 Jun 2002 18:35:56 -0700
Newsgroups gmane.comp.java.webwork.cvs
Message-ID <[email protected]>
Update of /cvsroot/webwork/webwork/src/main/webwork/view/taglib
In directory usw-pr-cvs1:/tmp/cvs-serv17784a

Modified Files:
	WebWorkBodyTagSupport.java 
Log Message:
added support for classes that have editors with getAsText()

Index: WebWorkBodyTagSupport.java
===================================================================
RCS file: /cvsroot/webwork/webwork/src/main/webwork/view/taglib/WebWorkBodyTagSupport.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- WebWorkBodyTagSupport.java	23 Jun 2002 23:54:51 -0000	1.6
+++ WebWorkBodyTagSupport.java	30 Jun 2002 01:35:54 -0000	1.7
@@ -7,12 +7,15 @@
 package webwork.view.taglib;
 
 import webwork.util.ValueStack;
+import webwork.util.BeanUtil;
+import webwork.action.ValidationEditorSupport;
 
 import javax.servlet.jsp.PageContext;
 import javax.servlet.jsp.tagext.BodyTagSupport;
 import javax.servlet.jsp.tagext.Tag;
 import java.io.ByteArrayOutputStream;
 import java.io.PrintWriter;
+import java.beans.PropertyEditor;
 
 import org.apache.log4j.Category;
 
@@ -54,10 +57,20 @@
       return getStack().findValue(aName);
    }
 
+   /**
+    * Will return the string value of the object. If the object
+    * has a ValidationEditor then its getAsText() will be called
+    * which by default calls toString() unless you override it.
+    */
    protected String findString(String aName)
    {
+      String result = null;
+
       Object value = getStack().findValue(aName);
-      return value == null ? null : value.toString();
+      if (value!=null) {
+         result = BeanUtil.toStringValue(value);
+      }
+      return result;
    }
 
    protected String toString(Throwable t)




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
No, I will not fix your computer.
http://thinkgeek.com/sf