permaculture playing cards*
The moose likes Struts and the fly likes html:text Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html:text" Watch "html:text" New topic
Author

html:text

Vivek Jaiswal
Greenhorn

Joined: May 20, 2006
Posts: 9
i want to use the disabled and readonly attribute of the html:text tag like this:-
<html:text property="something" readonly="<%=flag%>"/>

where "flag" is a String variable passed on to the jsp from the action class through request and can have values "true" or "false"
but i am gettin errors.....y cant i do it this way???
Vani Bandargal
Ranch Hand

Joined: Oct 06, 2005
Posts: 82
try this.
"<%=request.getParameter('flag'%>"/>
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Tell us the specific error you're getting. How did you define the "flag" variable?


Merrill
Consultant, Sima Solutions
Vivek Jaiswal
Greenhorn

Joined: May 20, 2006
Posts: 9
Originally posted by Merrill Higginson:
Tell us the specific error you're getting. How did you define the "flag" variable?


in action class:
request.setAttribute("DisplayFlag","true");



in jsp:

<%
String strWard=(String)request.getAttribute("WardNumber");
String dispFlag=(String)request.getAttribute("DisplayFlag");

%>


and this is how i am using it:

<html:text property="tinNumber" size="14" readonly="<%=dispFlag%>"/>


the error m gettin is:

[ServletException in:/Admin/ProcessDealer.jsp] Unable to compile class for JSP An error occurred at line: 64 in the jsp file: /Admin/ProcessDealer.jsp Generated servlet error: D:\NewWorkspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\work\Catalina\localhost\vatweb\org\apache\jsp\Admin\ProcessDealer_jsp.java:223: setReadonly(boolean) in org.apache.struts.taglib.html.BaseHandlerTag cannot be applied to (java.lang.String) _jspx_th_html_text_1.setReadonly(dispFlag);
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The <html:text> tag library is designed to accept a boolean in the readonly property, not a String. So, change your action code to:

request.setAttribute("DisplayFlag", new Boolean(true));

and in your JSP:

boolean dispFlag=((Boolean)request.getAttribute("DisplayFlag")).booleanValue();
Vivek Jaiswal
Greenhorn

Joined: May 20, 2006
Posts: 9
Originally posted by Merrill Higginson:
The <html:text> tag library is designed to accept a boolean in the readonly property, not a String. So, change your action code to:

request.setAttribute("DisplayFlag", new Boolean(true));

and in your JSP:

boolean dispFlag=((Boolean)request.getAttribute("DisplayFlag")).booleanValue();


thanx merril id worked!!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: html:text