title: SEVERE: Servlet.service() for servlet [package] in context with path [/portal] threw exception java.lang.NullPointerException
body: <p>I have a login page and I want to redirect to a registration page.But I get
  <code>HTTP Status 404 - /registration.jsp</code> error. the path or project hierarchy: <a href="http://i.stack.imgur.com/NyFhk.png" rel="nofollow">snapshot</a></p>
  
  <p>what i want is,if a  user is not resisted they can register by clicking<br>
  what i am not doing right</p>
  
  <p><strong>main.java</strong></p>
  
  <pre><code>protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  
          response.getWriter().append("Served at: ").append(request.getContextPath());
  
          RequestDispatcher view = request.getRequestDispatcher("/WEB-INF/Views/System/index.jsp");
          view.forward(request, response);
  
          String action = request.getParameter("action");
          if(action.equals("register"))
          {
             view = request.getRequestDispatcher("/WEB-INF/Views/System/registration.jsp");
             view.forward(request, response);
          } 
      }
  </code></pre>
  
  <p><strong>index.jsp</strong></p>
  
  <pre><code>    &lt;legend&gt; Login to Jupiter &lt;/legend&gt; 
  
              &lt;table class="table" border="1" width="30%" cellpadding="3"&gt;
                  &lt;thead&gt;
                      &lt;tr&gt;
                          &lt;th colspan="2"&gt;Login Here&lt;/th&gt;
                      &lt;/tr&gt;
                  &lt;/thead&gt;
                  &lt;tbody&gt;
                      &lt;tr&gt;
                          &lt;td&gt;User Name&lt;/td&gt;
                          &lt;td&gt;&lt;input type="text" name="username"  /&gt;&lt;/td&gt; 
                      &lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td&gt;Password&lt;/td&gt;
                          &lt;td&gt;&lt;input type="password" name="userpass"  /&gt;&lt;/td&gt; 
                      &lt;/tr&gt;
  
                      &lt;tr&gt;
                          &lt;td colspan="2"&gt;New Employee!! &lt;a class="btn btn-info" href="/registration.jsp?action=register"&gt;Register Here&lt;/a&gt;&lt;/td&gt;
  
                      &lt;/tr&gt;
                  &lt;/tbody&gt;
              &lt;/table&gt;
  
              &lt;input type="submit"  name="action" value="Login" /&gt;
               &lt;/fieldset&gt; 
                &lt;/center&gt;
          &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Error logs</p>
  
  <pre><code>Feb 13, 2016 4:40:33 PM org.apache.catalina.core.StandardWrapperValve invoke
  SEVERE: Servlet.service() for servlet [com.greensun.jupiter.controller.main] in context with path [/Jupiter] threw exception
  java.lang.NullPointerException
      at com.greensun.jupiter.controller.main.doGet(main.java:32)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      at java.lang.Thread.run(Thread.java:745)
  </code></pre>