Hmm.

First of all, disregard what I said before about BooleanConverter - that
only applies when the form is being submitted, not when it is being
rendered. My bad.

However, you're right, there is definitely a problem. I've confirmed it on
both Tomcat 4.1.10 and Resin 2.1.4.

What seems to happen is that, when a literal value is specified, the JSP
compiler automatically converts it to the appropriate boolean keyword, so
the resulting Java code compiles just fine. However, when an rtexpr is
specified, the JSP compiler is not generating code to convert a string value
into a boolean value, so the Java compilation fails.

Given that the behaviour is the same on both of the containers I tried, I
suspect there may be something in the JSP spec about this. It's not
something I've ever come across, though. Craig may be able to shed some more
light on this.

In any case, it appears that - unless both Tomcat and Resin suffer from the
same bug - we'll need to modify the <html:submit> tag to take a string
value, and deal with the conversion in Struts.

If you could submit a bug report to Bugzilla, that will ensure that this
issue doesn't get lost.

--
Martin Cooper


> -----Original Message-----
> From: Jerry Jalenak [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 05, 2002 3:02 PM
> To: 'Struts Users Mailing List'
> Subject: RE: [BUG] html:submit disabled= requires boolean value?
> 
> 
> That's what I thought.  I'm passing in a string value of 
> 'true' (no quotes).
> I've tried setting a session variable as well as setting an 
> attribute in a
> bean but I get the same results.  In the .JSP I use
> 
>       (when using a session var)
> 
>       <% String buttonStatus = (String)
> session.getAttribute("buttonStatus"); %>
>       <html:submit property="action" value="Update"
> disabled="<%=buttonStatus%>" />
> 
>       (when using a bean)
> 
>       <bean:define id="buttonStatus" name="myBean" 
> property="buttonStatus"
> />
>       <html:submit property="action" value="Update"
> disabled="<%=buttonStatus%>" />
> 
> Either way I get casting problems.  As long as I directly 
> code "true" as the
> value, it works fine.  I only get this problem when I try to 
> pass in a value
> as a runtime expression.
> 
> 
> Jerry 
> 
> > -----Original Message-----
> > From: Martin Cooper [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, September 05, 2002 4:52 PM
> > To: 'Struts Users Mailing List'
> > Subject: RE: [BUG] html:submit disabled= requires boolean value?
> > 
> > 
> > From the docs for the <html:submit> 'disabled' attribute:
> > 
> > "Set to true if this input field should be disabled."
> > 
> > The field in the tag is a boolean, so the value you supply must be
> > convertable to a boolean. The conversion of the string you 
> supply to a
> > boolean is performed in BeanUtils.BooleanConverter, where:
> > 
> > true, yes, y, on, 1 are all synonyms
> > false, no, n, off, 0 are all synonyms
> > 
> > As long as you pass one of these values (or an expression 
> > that evaluates to
> > one of these values), you'll be fine.
> > 
> > --
> > Martin Cooper
> > 
> > 
> > > -----Original Message-----
> > > From: Jerry Jalenak [mailto:[EMAIL PROTECTED]]
> > > Sent: Thursday, September 05, 2002 2:17 PM
> > > To: 'Struts Users Mailing List'
> > > Subject: RE: [BUG] html:submit disabled= requires boolean value?
> > > 
> > > 
> > > OK.  I think I've proven to myself that this is not a bug, as 
> > > I can set
> > > disabled="true" and everything works fine.  When I try to 
> > use either a
> > > session variable (see below) or create a temporary bean, I 
> > get strange
> > > messages, like 'Can't convert java.lang.Object to boolean'.  
> > > I'm at a loss.
> > > 
> > > 
> > > What's the right way to do this?
> > > 
> > > Jerry
> > > 
> > > > -----Original Message-----
> > > > From: Jerry Jalenak [mailto:[EMAIL PROTECTED]]
> > > > Sent: Thursday, September 05, 2002 2:45 PM
> > > > To: '[EMAIL PROTECTED]'
> > > > Subject: [BUG] html:submit disabled= requires boolean value?
> > > > 
> > > > 
> > > > I'm setting the value of the disabled= parameter on a 
> > > > <html:submit> tag, and
> > > > I'm getting the following error:
> > > > 
> > > >         Incompatible type for method. Can't convert 
> java.lang.String to
> > > > boolean. _jspx_th_html_submit_2.setDisabled(buttonStatus);
> > > > 
> > > > The code in the .JSP looks like this.....
> > > > 
> > > >         <%
> > > >                 String buttonStatus = (String)
> > > > session.getAttribute("ButtonStatus");
> > > >         %>
> > > >         <html:submit property="action" value="Update"
> > > > disabled="<%=buttonStatus%>" /> 
> > > > 
> > > > I've looked at the javadoc for the BaseHandler and the 
> > > > setDisabled method is
> > > > looking for a boolean value to be passed in.  It looks like 
> > > > the tag is not
> > > > converting the string to a boolean before trying to call the 
> > > > setDisabled
> > > > method.  Has anyone else come across this?  Or am I just 
> > flat doing
> > > > something wrong?
> > > > 
> > > > TIA,
> > > > 
> > > > 
> > > > Jerry Jalenak
> > > > Web Publishing
> > > > LabOne, Inc.
> > > > 10101 Renner Blvd.
> > > > Lenexa, KS  66219
> > > > (913) 577-1496
> > > > [EMAIL PROTECTED]
> > > > 
> > > > 
> > > > This transmission (and any information attached to it) may be 
> > > > confidential and is intended solely for the use of the 
> > > > individual or entity to which it is addressed. If you are not 
> > > > the intended recipient or the person responsible for 
> > > > delivering the transmission to the intended recipient, be 
> > > > advised that you have received this transmission in error and 
> > > > that any use, dissemination, forwarding, printing, or copying 
> > > > of this information is strictly prohibited. If you have 
> > > > received this transmission in error, please immediately 
> > > > notify LabOne at (800)388-4675.
> > > > 
> > > > 
> > > > 
> > > > --
> > > > To unsubscribe, e-mail:   
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > 
> > > 
> > > This transmission (and any information attached to it) may be 
> > > confidential and is intended solely for the use of the 
> > > individual or entity to which it is addressed. If you are not 
> > > the intended recipient or the person responsible for 
> > > delivering the transmission to the intended recipient, be 
> > > advised that you have received this transmission in error and 
> > > that any use, dissemination, forwarding, printing, or copying 
> > > of this information is strictly prohibited. If you have 
> > > received this transmission in error, please immediately 
> > > notify LabOne at (800)388-4675.
> > > 
> > > 
> > > 
> > > --
> > > To unsubscribe, e-mail:   
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail: 
> > > <mailto:[EMAIL PROTECTED]>
> > > 
> > > 
> > 
> > 
> > --
> > To unsubscribe, e-mail:   
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: 
> > <mailto:[EMAIL PROTECTED]>
> > 
> > 
> 
> This transmission (and any information attached to it) may be 
> confidential and is intended solely for the use of the 
> individual or entity to which it is addressed. If you are not 
> the intended recipient or the person responsible for 
> delivering the transmission to the intended recipient, be 
> advised that you have received this transmission in error and 
> that any use, dissemination, forwarding, printing, or copying 
> of this information is strictly prohibited. If you have 
> received this transmission in error, please immediately 
> notify LabOne at (800)388-4675.
> 
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 
> 


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to