public class Relay extends HttpServlet { @Override public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String command = request.getParameter("command"); RequestDispatcher rd =request.getRequestDispatcher(command); rd.forward(request, response); System.out.println("Request forwarded to " + command + " servlet"); } }
This is my relay serv, I am sending a date from
<form action="Relay" method="POST" enctype="multipart/form-data"> / <input type="hidden" name="command" value="AddProduct" /> <input type="text" name="pname" value="" /> <input name="" type="submit" value="Add Product"> </form>
It provides a java.lang.NullPointerException exception. enctype = "multipart / form-data" // when im removes its work fine
source share