Skip to content

Instantly share code, notes, and snippets.

@ghusta
Created May 2, 2018 12:26
Show Gist options
  • Save ghusta/b91e1a0bb9b59f3bf7e434f870d4066c to your computer and use it in GitHub Desktop.
Save ghusta/b91e1a0bb9b59f3bf7e434f870d4066c to your computer and use it in GitHub Desktop.
JSP redirection preserving parameters
<%@ page contentType="text/html; charset=UTF-8" trimDirectiveWhitespaces="true" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:redirect url="/login.jsp">
<c:forEach items="${param}" var="entry">
<c:param name="${entry.key}" value="${entry.value}" />
</c:forEach>
</c:redirect>
@ghusta
Copy link
Author

ghusta commented May 2, 2018

@ghusta
Copy link
Author

ghusta commented May 2, 2018

Could also work simply with :

<jsp:forward page="/login.jsp" />

See Forward versus redirect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment