You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Davide Bruzzone <Da...@ngt.com> on 2002/11/12 17:08:55 UTC
RE: Why would disabled="..." not take a runtime expression? The d
ocs say that it should...
This was it exactly... Actually, upon further digging yesterday, I did
notice that when I got rid of the scope-related problem, the error was
complaining about a type mismatch (As you said, trying to stuff a String
into a boolean primitive. Sure enough, when I looken in BaseTagHandler.java,
disabled is a boolena primitive).
Thanks Martin...
Dave
> -----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() %>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>