aspose file tools*
The moose likes Struts and the fly likes Disabling html:text in Struts dynamically Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Disabling html:text in Struts dynamically" Watch "Disabling html:text in Struts dynamically" New topic
Author

Disabling html:text in Struts dynamically

Yevgeniy Treyvus
Ranch Hand

Joined: Mar 09, 2005
Posts: 48
How do I disable a text field based on a bean property in Struts ?


SCJP, SCJD
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The only way I know that works is through a JSP scriptlet that evaluates to a boolean as in:

<html:text property="myProperty" disabled='<%=myJavaExpression.isdisabled() %>' />


Merrill
Consultant, Sima Solutions
Yevgeniy Treyvus
Ranch Hand

Joined: Mar 09, 2005
Posts: 48
I tried that, but I get the following error:

/WEB-INF/tiles/websm/carrier/info.jsp(23,32) According to TLD or attribute directive in tag file, attribute value does not accept any expressions

But looking at the TLD itself, it says RTexpr is true.

Any ideas?
Damanjit Kaur
Ranch Hand

Joined: Oct 18, 2004
Posts: 346
RTexpr is true means- the value for attribute disabled has to be "true".

<html:text property="myProperty" disabled="true" />
Yevgeniy Treyvus
Ranch Hand

Joined: Mar 09, 2005
Posts: 48
I thought it meant that it took RT expression as values for arguments used by the tag (i.e) disabled="$(user.readOnly}". Is that not correct ?
[ May 05, 2005: Message edited by: Yevgeniy Treyvus ]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Are you using Struts 1.1 or above? I just ran a test (I'm using WebSphere V5.1) and this works for both a true and a false value.

Here's my code:

Action class:


jsp:


Try posting the code in your jsp, and maybe we can see what the problem is.
Ganesh Gowtham
Ranch Hand

Joined: Mar 30, 2005
Posts: 225

in <html:html> we have style attribute if suppose ur html property name "text1" we can give style="display:none" to make this filed visible style="display:inline"

if not just use expression <%= onj.canFieldVisible() %> ang assign to style attribute of input tag...

Gowtham G R
gowtham@eprosoft.com
grgowtham_cse@yahoo.com


Thanks, Ganesh Gowtham
http://ganesh.gowtham.googlepages.com
 
wood burning stoves
 
subject: Disabling html:text in Struts dynamically