0

Error when trying to redirect from servlet to JSP page with Parameters:

My Servlet Code is a follows:

       String name = "Test";
       request.setAttribute("name", name);
       RequestDispatcher view = request.getRequestDispatcher("/page.jsp");
       view.forward(request, response);

JSP Page is as follows:

<!doctype html>
<html lang="en">
    <head>
        <title>SO question 2370960</title>
    </head>
    <body>
         <p>Message: ${name}</p>
    </body>
</html> 

I am getting the following errors:

 Jan 24, 2014 12:05:35 PM org.apache.jasper.runtime.JspFactoryImpl internalGetPageContext
 SEVERE: Exception initializing page context
 java.lang.NoClassDefFoundError: javax/el/StaticFieldELResolver
 at        org.apache.jasper.runtime.JspFactoryImpl.internalGetPageContext(JspFactoryImpl.java:172)
at org.apache.jasper.runtime.JspFactoryImpl.getPageContext(JspFactoryImpl.java:123)
at org.apache.jsp.captcha_jsp._jspService(captcha_jsp.java:34)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:411)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:473)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:377)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
... 35 more

Please assist.

1 Answers1

0

Install New version of TomCat

ServletContext context = getServletContext();
RequestDispatcher rd = context.getRequestDispatcher("/page.jsp");
rd.forward(request, response);

make sure the path is correct

SuRu
  • 739
  • 1
  • 6
  • 19