That will work I suppose I was just hoping that there was a somewhat more
elegant way of doing it, the fact that I'm not using JSTL should have hit me
in the face that this wouldn't be elegant however.

thanks for the thought.

On 11/14/06, Puneet Lakhina <[EMAIL PROTECTED]> wrote:

On 11/14/06, Adam K <[EMAIL PROTECTED]> wrote:
>
> Hi all , I am attempting to do the following, and it obviously isn't
> working, but I was hoping someone on the list would point me to
something
> that might work instead:
>
> I have this text field and I want to be able to alternate the readonly
> property from true and false.  I tried to put in the below which is
bolded
>
>                         <html:text name="OrderForm" property="shipTo"
> readonly="WANTTOTOGGLE"  ></html:text>
>
>
>                         <html:text name="OrderForm" property="shipTo"
> readonly="<html:text name="OrderForm" property="readonly"></html:text>"
> ></html:text>
>
> Any thoughts or ideas as to how I could do that in a nice manner would
be
> greatly appreciated.
>
> What is going to happen is that the action is going to toggle the value
> depending on a parameter comming in from the URL.


so supposing your url has something like this
http://foo.com/bar.do?editable=true

Then you could have in your JSP
<logic:present parameter="editable">
<logic:equal parameter="editable" value="true">
<bean:define id="isReadOnly" scope="page">false</bean:define>
</logic:equal>
<logic:notEqual>
<bean:define id="isReadOnly" scope="page">true</bean:define>
</logic:notEqual>
</logic:present>
<logic:notPresent parameter="editable">
<bean:define id="isReadOnly" scope="page">true</bean:define>
</logic:notPresent>

So now your text box would have

<html:text property="foo" readonly='<%=new
Boolean(pageContext.getAttribute
("isReadOnly").toString()).booleanValue()%>'
/>

I know this is unclean but just doing bean write instead of the scriptlet
thing didnt work for me. You could probably clean up the logic tags also.
But i havent ever done JSTL so...


thanks in advance for any thoughts or ideas.
>
>

Hope it helps
--
Puneet


Reply via email to