I have the following code in one of my JSP :
<c:redirect url="someFile.jsp">
<c:param name="source" value="${param.source}" />
<c:param name="target" value="${param.target}" />
<c:param name="value" value="${param.value}" />
</c:redirect>
The requested JSP [ someFile.jsp ] access the parameters by the below way :
String source = request.getParameter("source");
String target = request.getParameter("target");
String value = request.getParameter("value");
But instead of <c:redirect url
I need to use response.sendRedirect("someFile.jsp")
method.
But I am not sure how to use the above parameters along with the jsp file name in the sendRedirect method.
Can someone help me out how should I write my redirect method.Can we do something like this :
response.sendRedirect("someFile.jsp?source=" + source + "?target=" +target + "?value=" +value);
OR
session.setAttribute("source",source)
session.setAttribute("target",target)
session.setAttribute("value",value)
response.sendRedirect("someFile.jsp")
question from:
https://stackoverflow.com/questions/65920628/how-to-write-response-sendredirect-method-with-paramters-in-jsp 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…