> -----Original Message-----
> From: Davide Bruzzone [mailto:Davide.Bruzzone@;ngt.com]
> Sent: Monday, November 11, 2002 2:36 PM
> To: Struts Users Mailing List
> Subject: Why would disabled="..." not take a runtime expression? The
> docs say that it should...
> 
> 
> Greetings all...
> 
> I'm trying to control whether or not some form fields are 
> editable using a
> custom security tag. So, at the top of the page, I have 
> something like this:
> 
> <%-- Page security --%>
> <bean:define id="readOnly" type="java.lang.String" value="false"/>
>                       
> <ngt-security:hasNoPermission deny="deny">
>       <bean:define id="readOnly" type="java.lang.String" 
> value="true"/>
> </ngt-security:hasNoPermission>
> 
> If the deny attribute is anything but null or an empty 
> string, readOnly is
> set to "true". Then I try to do this:
> 
> <html:select property="priority" styleClass="fullwidth" disabled="<%=
> readOnly %>">
>       ...
> </html:select>
> 
> What I get back is that the readOnly symbol cannot be 
> resolved...

The problem is that you are passing a String to an attribute that requires a
boolean. The documentation could certainly be more clear (you could submit a
Bugzilla item if you like), but you will note that it states *true* and not
*"true"* as an appropriate value.

If you want 'readOnly' to be a String, you'll have to use something like
this for the value of the 'disabled' attribute:

    <%= Boolean.valueof(readOnly).booleanValue() %>

--
Martin Cooper


> However,
> the following tests work:
> 
> - <html:select property="priority" styleClass="fullwidth" 
> disabled="true">
> - <%= readOnly %> (On its own... This prints out "true")
> 
> This is just strange. According to the documentation, 
> disabled should be
> able to take a runtime expression, and I use runtime 
> expressions of the form
> <%= someVariable %> all over the palce elsewhere.
> 
> Any insight would be greatly appreciated.
> 
> Cheers...
> 
> Davide Bruzzone
> 
> 
> --
> To unsubscribe, e-mail:   
<mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@;jakarta.apache.org>



--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>

Reply via email to