struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul McCulloch <>
Subject RE: Setting html:text readonly attribute
Date Mon, 03 May 2004 15:09:34 GMT
You cannot use one jsp tag to supply another jsp tag with a value for an

Some solutions are:

1) Use an html (rather than a jsp) tag:

 <input type="text" name="licenceCount" value="<c:out
value='${purchaseForm.licenceCount}'/>" size="3" readonly="<c:out
value='${purchaseForm.newPurchase}'/>" maxlength="5"/>

2) Use a bean defintion and an rt expression:

<bean:define id="readOnly" name="purchaseForm" property="newPurchase"/>

<html:text property="licenceCount" size="3" readonly="<%=readOnly%>"

3) Use struts el tag:

<html-el:text property="licenceCount" size="3"
readonly="${purchaseForm.licenceCount}" maxlength="5"/>


> -----Original Message-----
> From: John Moore []
> Sent: Monday, May 03, 2004 2:30 PM
> To:
> Subject: Setting html:text readonly attribute
> I'm having a big problem trying to dynamically set a value
> for the readonly
> attribute of an <html:text> tag. I'm using a JSTL core tag to
> try to set it
> and whatever I do is ignored.
> In the example below, the newPurchase property is a boolean. If I use
> exactly this tag elsewhere on the page, it outputs true or false as
> expected. Here, though, it has no effect on the attribute, whether
> newPurchase is true or false - the input tag generated is missing the
> 'readonly' attribute.
>          <html:text property="licenceCount" size="3" readonly="<c:out
> value='${purchaseForm.newPurchase}'/>" maxlength="5"/>
> I've also tried the following (with as little effect), using
> an escaped
> double-quote instead of a single quote:
>          <html:text property="licenceCount" size="3" readonly="<c:out
> value=\"${purchaseForm.newPurchase}\"/>" maxlength="5"/>
> The curious thing is that I can use a similar construct but
> with an integer
> property to dynamically set other attributes, such as size, as in the
> following example (ignore the logical nonsense of assigning a
> size on such
> a basis, it's just a test of technical feasibility):
>          <html:text property="licenceCount" size="<c:out
> value=\"${purchaseForm.totalLicences}\"/>" maxlength="5"/>
> Is there something to do with assigning boolean attributes in
> these tags
> which I haven't got yet? Or is it just soemthing weird with
> the readonly one?
> John
> =============================================
> John Moore     -    Norwich, UK    -
> ============================================= 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message