I want to display selected Row data from jsp page to another jsp page.For taht i am passing selected row data to servlet using the hidden id. But I am getting the null pointer exception while sending data from jsp to Servlet.
please find my below code:
In jsp code:
<tr >
<form action="DisplayData" method="get">
<TD ><%=item.getAPPLICATIONID()%></TD>
<TD><%=item.getAPPLICATIONNAME()%></TD>
<input type="hidden" id="sid" name="sid" value=<%=item.getAPPLICATIONID() %>>
<TD><input type="submit" value="Submit" ></TD>
<%
}
Servlet Code:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
DBConnection db=new DBConnection();
HttpSession hs = request.getSession();
Integer pid =(Integer) request.getAttribute("sid");
List<ApplicationList> dbean=db.getAllaplicationsList(pid);
hs.setAttribute("detbean",dbean);
response.sendRedirect("Output.jsp");
}
I am getting null pointer Exception in Servlet page. The value is pid is showing null.Could you please suggest me how can resolve this issue.