So I’m coding a Liferay portlet that will display one of two forms on it, depending on the type of customer that is viewing the page. In order to implement this, I decided to that the JSTL ‘choose’ tag would be perfect for what I need.
<c:choose>
<c:when test='<%= displayForm.equals("Form1") %>'>
...code for form 1...
</c:when>
<c:when test='<%= displayForm.equals("Form2") %>'>
...code for form 2...
</c:when>
</c:choose>
But when I deploy and run my code, I get this error:
According to TLD or attribute directive in tag file, attribute test does not accept any expressions
After about 30 minutes of searching I found the solution on this page.
I had to change
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
to
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
After that simple tweak, my forms display correctly.
No idea what this does or why I had to do it. But it worked, so I’m happy.