Passing variables to the view in SPRINGMVC are enumerated types, defined as:
Package Com.xxx.pojo;
public enum Createuserresult {
success,duplicateloginname
}
The value passed to the view is named result
This will fail when determining whether result is createuserresult.duplicateloginname in the JSP, as follows:
<c:choose>
<c:when test= "${result eq createuserresult.duplicateloginname}" >
<span class= " Error > The sign-in name you entered already exists, please replace the sign-in name and try again. </span></c:when>
<c:otherwise></c:otherwise>
</c:choose>
The reason for the failure is that the EL Lookup variable is looking for a variable from a range of page,request,session, Createuserresult.duplicateloginname is an enumerated type value, and there is no way to write it directly.
One trick to do this is to set a variable with a jstl set expression and compare it. The following code
<c:set var= "Duplicateloginname" value= "<%=createuserresult.duplicateloginname%>"/> <c:if test= "${not Empty Result}" > <c:choose> <c:when test= "${result eq duplicateloginname}" > <spa N class= "Error" > The sign-in name you entered already exists, please replace the sign-in name and try again. </span></c:when> <c:otherwise></c:otherwise> </c:choose> </c:if>