I have a JSP page, which is full of tables form when I click submit it on the servlet Which is used to read the values of the forms in the survey using the getParamValues method but it is not working. When I try to print string array from GetParamValues, I get nullpointerexceptions
Here is the relevant servlet code:
Public Zero doPost (httpPrelevate Request ), IOException throws, ServletException {resp.setContentType ("text / plain"); PrintWriter out = resp.getWriter (); String [] nums = req.getParameterValues ("questNum"); Out.println (nums [2]); } Secure zero doGet (HttpServletRequest request, HttpServletResponse resp) throws IOException, ServletException {doPost (req, resp); } Here is the relevant JSP code, running on GAE:
& Lt;% @ Page Import = "com.surveycreator.service.preistence.SurveyPersistence"%> & Lt;% @ Page Import = "com.surveycreator.service.model.Sarvey"%> & Lt;% @ Page Import = "com.surveycreator.service.model.SurveyQuestion"%> & Lt;% @ Page Import = "com.surveycreator.service.model.Sarvey"%> & Lt;% @ Page Import = "java.util.list"% & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Link type = "text / css" rel = "stylesheet" href = "/ stylesheets / main.css" /> & Lt; / Head & gt; & Lt; Body & gt; & Lt; P & gt; View survey & lt; / P & gt; & Lt; Form action = "/ storeserver" method = "post" & gt; & Lt; Input type = "submit" value = "submit survey" /> & Lt; / Form & gt; & Lt;% SurveyPersistence continues = new survey (); String survey name = request.getParameter ("content"); Survey survey = persist.getserve (survey name); & Lt; SurveyQuestion & gt; Question = Survey.GatesServe (); Out.println ("& lt; Table border = '1' & gt; & lt; tr & gt; & lt; th & gt; Question number & lt; / th> & lt; th & gt; Surveys question (Yes / Yes)) & lt; / or & gt; & lt; / tr & gt; "); (Survey Question Question: Object: Question) {int tableCounterString = questionObject.getQuestionNumber (); String search = Question object. Grah Query (); Out.println ("& lt; tr>