tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pilho Kim <>
Subject Re: setProperty and <input type="image" ..>
Date Thu, 01 Jan 1970 00:00:00 GMT
> 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.

In Servlet source:

    public Point getBlahPoint(HttpServletRequest req) {
        int x = Integer.parseInt(req.getParameter("blah.x"));
        int y = Integer.parseInt(req.getParameter("blah.y")); 
        return new Point(x, y);

In JSP source:

    Point bp = blahBean.getBlahPoint(request);
    int x = bp.x; 
    int y = bp.y;

> 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
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message