craigmcc    01/01/27 19:59:12

  Modified:    src/share/org/apache/struts/taglib/bean DefineTei.java
  Log:
  Allow <bean:define> to work when the "value" attribute is set to an
  arbitrary object (via a runtime expression), and the "type" attribute is
  not specified.  The data type of the scripting variable being craeted will
  be equal to the class of the object created by the runtime expression.
  
  Submitted by:  Incze Lajos <[EMAIL PROTECTED]> and
    Joshua Hill <[EMAIL PROTECTED]>
  
  Revision  Changes    Path
  1.4       +7 -6      
jakarta-struts/src/share/org/apache/struts/taglib/bean/DefineTei.java
  
  Index: DefineTei.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/DefineTei.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefineTei.java    2000/12/30 21:15:37     1.3
  +++ DefineTei.java    2001/01/28 03:59:12     1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/DefineTei.java,v 1.3 
2000/12/30 21:15:37 craigmcc Exp $
  - * $Revision: 1.3 $
  - * $Date: 2000/12/30 21:15:37 $
  + * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/bean/DefineTei.java,v 1.4 
2001/01/28 03:59:12 craigmcc Exp $
  + * $Revision: 1.4 $
  + * $Date: 2001/01/28 03:59:12 $
    *
    * ====================================================================
    *
  @@ -73,7 +73,7 @@
    * tag, identifying the scripting object(s) to be made visible.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.3 $ $Date: 2000/12/30 21:15:37 $
  + * @version $Revision: 1.4 $ $Date: 2001/01/28 03:59:12 $
    */
   
   public class DefineTei extends TagExtraInfo {
  @@ -85,9 +85,10 @@
       public VariableInfo[] getVariableInfo(TagData data) {
   
           String type = data.getAttributeString("type");
  +        Object value = data.getAttribute("value");
           if (type == null) {
  -            if (data.getAttributeString("value") != null)
  -                type = "java.lang.String";
  +            if (value != null)
  +                type = value.getClass().getName();
               else
                   type = "java.lang.Object";
           }
  
  
  

Reply via email to