tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pilho Kim <ph...@math.soongsil.ac.kr>
Subject Re: setProperty and <input type="image" ..>
Date Thu, 01 Jan 1970 00:00:00 GMT

Jack,

Try to use getBlah_X() and getBlah_Y() instead of getBlah.X() and getBlah.Y()

My workaround (about "." problem with jsp:setProperty) is as follows:


org.apache.jasper.runtime.JspRuntimeLibrary



    // __begin introspecthelperMethod
    public static void introspecthelper(Object bean, String prop,
					String value, ServletRequest request,
					String param, boolean ignoreMethodNF) 
					throws JasperException
    {
        java.lang.reflect.Method method = null;
        Class                    type   = null;
+
+       prop = prop.replace('.', '_');
+
	try {
	    java.beans.BeanInfo info
		= java.beans.Introspector.getBeanInfo(bean.getClass());
	    if ( info != null ) {
		java.beans.PropertyDescriptor pd[]
		    = info.getPropertyDescriptors();
		for (int i = 0 ; i < pd.length ; i++) {
		    if ( pd[i].getName().equals(prop) ) {
			method = pd[i].getWriteMethod();
			type   = pd[i].getPropertyType();
			break;
		    }
		}
	    }



> 
> Perhaps this is more of a problem with the JSP Spec, but setting properties 
> on a bean with jsp:setProperties for a form with multiple image submit 
> buttons seems to be an impossibility.
> 
> Specifically, the problem is that forms with image inputs produce strings in 
> the request object that look like "blah.x=10 blah.y=23" (mouse position) 
> where regular submit buttons just produce "blah=value". Naming methods in 
> the bean getBlah.X() and getBlah.Y() doesn't work, since the "." has special 
> meaning in Java.
> 
> For forms with only one image submit, adding a hidden tag with the same name 
> seems to fix the problem.  For forms with multiple image submit buttons, 
> there doesn't seem to be a good fix.
> 
> It also looks like setting the properties with parameter="blah.x" could be 
> promising, but this is rather awkward since it means that *all* other 
> properties for the bean must also be set individually.
> 
> How does tomcat handle request parameters with names containing periods in 
> relation to <jsp:setProperty name="blahBean" property="*"/>?  How should 
> they be handled?
> 
> Thanks!
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 
> 


Mime
View raw message