You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ak...@locus.apache.org on 2000/01/24 03:22:06 UTC

cvs commit: jakarta-tomcat/src/share/org/apache/jasper/compiler TagBeginGenerator.java

akv         00/01/23 18:22:06

  Modified:    src/share/org/apache/jasper/compiler TagBeginGenerator.java
  Log:
  commit by mandar@eng.sun.com
  
  TagHandlers properties to be set at the
  translation-time can be of any Java type.
  Before this fix, only String properties
  could be set.
  
  Revision  Changes    Path
  1.8       +15 -15    jakarta-tomcat/src/share/org/apache/jasper/compiler/TagBeginGenerator.java
  
  Index: TagBeginGenerator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/TagBeginGenerator.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TagBeginGenerator.java	1999/11/08 03:14:29	1.7
  +++ TagBeginGenerator.java	2000/01/24 02:22:06	1.8
  @@ -170,22 +170,22 @@
   	    for(int i = 0; i < attributes.length; i++) {
                   String attrValue = (String) attrs.get(attributes[i].getName());
                   if (attrValue != null) {
  -                    if (attributes[i].canBeRequestTime()) {
  -                        if (JspUtil.isExpression(attrValue))
  -                            attrValue = JspUtil.getExpr(attrValue);
  -                        else 
  -                            attrValue = writer.quoteString(attrValue);
  -                    } else
  -                        attrValue = writer.quoteString(attrValue);
  -                    
  +		    
                       String attrName = attributes[i].getName();
  -                    Method m = tc.getSetterMethod(attrName);
  -                    if (m == null)
  -                        throw 
  -                            new JasperException(Constants.getString("jsp.error.unable.to_find_method",
  -                                                                    new Object[] { attrName }));
  -                
  -                    writer.println(thVarName+"."+m.getName()+"("+attrValue+");");
  +		    
  +		    if (!JspUtil.isExpression (attrValue)) {
  +			writer.println("JspRuntimeLibrary.introspecthelper(" +
  +				       thVarName + ",\"" + attrName +
  +				       "\",\"" + JspUtil.escapeQueryString(attrValue) +
  +				       "\",null,null,false);");
  +		    } else {
  +			
  +			// This requires some careful handling.
  +			// int, boolean, ... are not Object(s).
  +			writer.println("JspRuntimeLibrary.handleSetProperty(" +
  +				       thVarName + ",\"" + attrName +
  +				       "\"," + JspUtil.getExpr(attrValue) + ");");
  +		    }
                   }
               }
       }