Reputation: 2891
I have the following tag:
<html:text styleClass="span2" property="groupManagerId" styleId="groupManagerId" maxlength="19" size="10" readonly="" />
which works correctly. When I add a style
attribute:
<html:text styleClass="span2" style="display:<%=(""+FVConstants.NORMAL).equalsIgnoreCase(groupData.getGroupType())?"none":" "%>;" property="groupManagerId" styleId="groupManagerId" maxlength="19" size="10" readonly="" />
I get the following error:
org.apache.jasper.JasperException: /pages/POS0085_group_modify.jsp(95,61) Unterminated <html:text tag
I have the same attribute under label
and div
tags and it works correctly. I changed to
<%String displayValue=(""+FVConstants.NORMAL).equalsIgnoreCase(groupData.getGroupType())?"none":" ";
String displayAttr="display:"+displayValue; %>
and
<html:text styleClass="span2" style="display:<%=displayValue%>" property="groupManagerId" styleId="groupManagerId" maxlength="19" size="10" readonly="" />
and it works. What is wrong with the first attempt? Is there a better way to do this?
Upvotes: 0
Views: 898
Reputation: 1
This error often happened when beginners trying to use the ?
operator to evaluate to string. The evaluated expression should be surrounded with the brackets like that
<html:text styleClass="span2" style="display:<%=((""+FVConstants.NORMAL).equalsIgnoreCase(groupData.getGroupType())?"none":" ")%>;" property="groupManagerId" styleId="groupManagerId" maxlength="19" size="10" readonly="" />
Upvotes: 0