We have migrated the tomcat from version tomcat-5.5.15
to tomcat-7.0.62
.
The below code works fine with the older verions of tomcat i.e tomcat-5.5.15
<%!
private final String
barredUserTextId = "lightBlue",
barredUserTextClass = "smalli";
%>
<summary:table summary='userlist' rowTextId='<%= "black,${userStatusTextCode}==sd_user_status_barred?"+barredUserTextId %>' rowTextClass='<%= "small,${userStatusTextCode}==sd_user_status_barred?"+barredUserTextClass%>'>
But the same code doen not work with new version of tomcat.
The part of code which has issue with new version(tomcat-7.0.62
) of tomcat is
rowTextId='<%= "black,${userStatusTextCode}==sd_user_status_barred?"+barredUserTextId %>'
rowTextClass='<%= "small,${userStatusTextCode}==sd_user_status_barred?"+barredUserTextClass%>'
The above line of code is not working for me.
I tried changing it like below , but none of it worked for me.
<summary:table summary='userlist' rowTextId="<%= {userStatusTextCode} eq \"sd_user_status_barred\" ? \"lightBlue\" : \"black\" %>" rowTextClass="${userStatusTextCode eq \"sd_user_status_barred\" ? \"smalli\" : \"small\" }">
<summary:table summary='userlist' rowTextId='<%= ${userStatusTextCode} == "sd_user_status_barred" ? "black" : "lightBlue" %>' rowTextClass='<%= ${userStatusTextCode} == "sd_user_status_barred" ? "smalli" : "small" %>'>
<summary:table summary='userlist' rowTextId="<%= ${(userStatusTextCode == 'sd_user_status_barred') ? \"black\" : \"lightBlue\" %>" rowTextClass="<%= ${(userStatusTextCode} == 'sd_user_status_barred') ? \"smalli\" : \"small\" %>" >
<summary:table summary='userlist' rowTextId="${(userStatusTextCode == 'sd_user_status_barred') ? \"black\" : \"lightBlue\" }" rowTextClass="${(userStatusTextCode == 'sd_user_status_barred') ? \"smalli\" : \"small\" }" >
<summary:table summary='userlist' rowTextId="${(userStatusTextCode == 'sd_user_status_barred') ? 'lightBlue' : 'black' }" rowTextClass="${(userStatusTextCode == 'sd_user_status_barred') ? 'smalli' : 'small' }" >
I have already referred the some links and tried it
Here are the referred links
How to write if else condition using ternary operator in jstl
http://www.javabeat.net/ternary-operator-in-jsp-2-0-expression-languageel/
How to correctly write the expression so that it will work with tomcat 7.