I'm trying to make the servlet work as a controller I was following the caelum handout but I can not find the error
aservlet
@WebServlet(urlPatterns="/LoginInfo")
public class LoginInfo extends HttpServlet {
public LoginInfo(){
super();
}
@Override
protected void doGet(HttpServletRequest request,HttpServletResponse response)
throws ServletException, IOException{
}
protected void doPost(HttpServletRequest request,HttpServletResponse response)
throws ServletException, IOException{
String acao = request.getParameter("acao");
String usuario = request.getParameter("usuario");
String senha= request.getParameter("senha");
Login login = new Login();
login.setUsuario(usuario);
login.setSenha(senha);
RequestDispatcher rd = null;
if(acao.equals("Entrar")){
rd = request.getRequestDispatcher("/paginaInicial.jsp");
rd.forward(request, response);
}
}
andtheerrorthatgives
java.lang.NullPointerException br.vitor.controller.LoginInfo.doPost(LoginInfo.java:41) javax.servlet.http.HttpServlet.service(HttpServlet.java:648) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
Thisisalinethatcomparesifitisequalto"Enter"