tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nikola Milutinovic" <Nikola.Milutino...@ev.co.yu>
Subject Expression Language question
Date Sun, 01 Jun 2003 17:39:13 GMT
 Simple question.

I have a JSP/Servlet combination in which Servlet is used to authenticate user and create
a session. A JSP page then checks for the existence of the session and reads neccessary ID
from it. I'm switching to JSTL and I'd like to switch to EL, now. Here is the old code, how
can I translate it to EL?

OLD CODE
-------------
<%@ page contentType="text/html; charset=windows-1250"
         ...
         session="true"
         ...
%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/sql" prefix="sql" %>
<%
if (session.isNew()) {
  response.sendRedirect( response.encodeRedirectURL( "Error.jsp?reason=Wrong+login" ) );
}
%>

NEW CODE (the only thing I can come up with)
-------------------------------------------------
<%@ page contentType="text/html; charset=windows-1250"
         ...
         session="true"
         ...
%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/sql" prefix="sql" %>
<c:if test="${empty sessionScope.userID}"/>
  <c:redirect url="Error.jsp?reason=Not+logged+in"/>
</c:if>
---------------------------------------------
Anybody got a better idea?

Nix. 
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message