Hi guys,
I am trying to redirect a 'HTTPrequest' from a JSP page to a servlet (located in a package); passing on variables that are stored in a session object. I had the idea to use:
<jsp:forward page"/servletName">
<jsp:param name="var1" value="<%=beanID.getVar1()%>" />
<jsp:param name="var2" value="<%=beanID.getVar2()%>" />
</jsp:forward>
In the servlet you can find a doPost with an @override annotation. With the following code:
public class servletName extends HttpServlet{
@Override
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException,IOException{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
var1 = request.getParameter("var1").toString();
var2 = request.getParameter("var2").toString();
// do more with the variables.
}
When running the project, the parameters get sent to the JSP where the redirect / forward is called. After the variables have been stored (and where the servlet has to be called [JSP:forward]) the app returns a 404 Page does not exist.
Does anybody have an idea? If clarification is needed, please tell me.
Thanks in advance! B.