3 Replies Latest reply on Jun 20, 2008 2:32 AM by 666705

    Redirect JSP Portlet

    666705
      Hi all..

      I am currently working with WLP8.1 SP5 and I am trying to redirect a jsp page to an error page to show error messages, im using JPF, I tried it using this:

      - jsp:forward

      - Using GlobalApp to catch any exception in the jsp page

      but I obtained a java null pointer exception.

      Any other idea to do this?

      Thanks a lot for your help!
        • 1. Re: Redirect JSP Portlet
          666705
          Im not sure what you are trying to do here , where are you getting the NullPointerException?

          Im guessing that you have written an error page and are getting the exception as null? In which case you need to add the errorPage="yourErrorPage.jsp" directive in your JSP and the isErrorPage="true" on your error page.
          If your getting some other NullPointer , post your code!
          • 2. Re: Redirect JSP Portlet
            666705
            Hi, my code is something like this:

            in page.jsp:

            if (condition)
            {
            JspContentContext jspContext = JspContentContext.getJspContentContext(request);
            jspContext.sendRedirect("error.jsp");

            }

            and i tried this too:
            if (condition)
            {
            <jsp:forward page="error.jsp"/>
            }



            the idea is, if condition is true, redirect the user to an error page, i tested both codes in the jpf and it works, but when i test in the portal the Java null pointer exception appears, im using this jsp like a portlet.

            Thanks!!!
            • 3. Re: Redirect JSP Portlet
              666705
              where are you getting the NullPointer exception? in error.jsp?
              Show the stack trace and code