Why cant I do the following...

I'm trying to set a variable with the value of the error message from the session object.

<c:set var="reason" value="<%= ((AuthenticationException) session.getAttribute(AbstractProcessingFilter.ACEGI_SECURITY_LAST_EXCEPTION_KEY)).getMessage() %>"></c:set>

<c:choose>

<c:when test="${reason=='User is disabled'}">

Dont be Daft!!! Use YOUR username and password

</c:when>

<c:otherwise>

<%= ((AuthenticationException) session.getAttribute(AbstractProcessingFilter.ACEGI_SECURITY_LAST_EXCEPTION_KEY)).getMessage() %>

</c:otherwise>

</c:choose>

However whenever I deploy I get the following error;

org.apache.jasper.JasperException: /acegilogin.jsp(29,8) According to TLD or attribute directive in tag file, attribute value does not accept any expressions

okay, fair enough. But then how do I set a variable to the value of this error message and then hence how do i run a check on it?

Message was edited by:

DontKnowJack

[1118 byte] By [DontKnowJacka] at [2007-11-27 10:31:48]
# 1

Have you tried this:

<c:set var="reason">

<%= ((AuthenticationException) session.getAttribute(AbstractProcessingFilter.ACEGI_SECURITY_LAST_EXCEPTION_KEY)).getMessage() %>

</c:set>

<c:choose>

<c:when test="${reason=='User is disabled'}">

Dont be Daft!!! Use YOUR username and password

</c:when>

<c:otherwise>

<c:out value="${reason}"/>

</c:otherwise>

</c:choose>

If that doesn't work, it may be that you don't have EL activated (Expression Language). What server do you have? What version of JSTL?

Message was edited by:

stevejluke

stevejlukea at 2007-7-28 18:12:08 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

yes that worked. Why did it work with the former syntax and not the latter?

Also I am using tomcat version 5.5 therefore a jsp 2.0 container and am using jstl 1.1.

DontKnowJacka at 2007-7-28 18:12:08 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...