Skip to content

Instantly share code, notes, and snippets.

@ghusta
Created May 2, 2018
Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

@ghusta ghusta commented May 2, 2018

@ghusta

This comment has been minimized.

Copy link
Owner Author

@ghusta 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