Forum Stats

  • 3,827,475 Users
  • 2,260,781 Discussions
  • 7,897,263 Comments

Discussions

While reading checkbox values by using getParameterValues("") method it says getting null error.

//jsp code

<input type="text" id="sname" name="sname" value="<%= rs.getString("name") %>" style="color:black;width:96%;text-align:center;height:35px" disabled/>


//Logic to handle jsp form request

if(request.getParameter("submt")!=null){

String name[]=request.getParameterValues("sname");

System.out.println(name[0]+"\t"+name[1]+"\t"+name[2]+"\t");

}


//

java.lang.NullPointerException: Cannot load from object array because "name" is null

Apr 11, 2022 1:07:13 PM org.apache.catalina.core.StandardWrapperValve invoke

SEVERE: Servlet.service() for servlet [jsp] in context with path [/StudentPortal] threw exception [An exception occurred processing [/AdminHome3.jsp] at line [39]

39: System.out.println(name[0]+"\t"+name[1]+"\t"+name[2]+"\t");