Страница Jsp, показывающая java.lang.numberformatexception: null
сэр, я создал страницу jsp для формы boq, чтобы обновить записи boq.
я написал бизнес-логику на странице jsp, чтобы сначала выбрать записи на основе идентификатора. когда я запускаю эту страницу.
затем страница, показывающая
java.lang.NumberFormatException: null
настоящим я написал всю кодировку целиком:
--------
BOQ-Form.jsp-----------------
<%@page import="java.sql.SQLException"%> <%@page import="java.sql.ResultSet"%> <%@page import="java.sql.Statement"%> <%@page import="com.mvc.util.DBConnection"%> <%@page import="java.sql.Connection"%> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Edit BOQ</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <title>Update BOQ</title> </head> <body> <%!int _ID; String _HsnCode, _ISHsnCodeConfirmed, GST_RATE, IS_GST_RATECONFIRMED,item_desc,UNIT,_QTY,_P,W,_V; %> <% try { _ID = Integer.parseInt(request.getParameter("id")); Connection con = DBConnection.createConnection(); Statement stmt = con.createStatement(); ResultSet rst = stmt.executeQuery("select * from boq where id="+_ID+""); if(rst.next()) { _HsnCode = rst.getString("hsn_Code"); _ISHsnCodeConfirmed = rst.getString("is_hsnConfirmed"); GST_RATE = rst.getString("gst_rate"); IS_GST_RATECONFIRMED= rst.getString("is_gstRate_confirmed"); item_desc = rst.getString("item_Description"); UNIT = rst.getString("Unit"); _QTY = rst.getString("Qty"); _P = rst.getString("p"); W = rst.getString("w"); _V = rst.getString("v"); } } catch(SQLException e) { out.println(e); response.sendRedirect("/error.jsp"); } %> <center> <div class="container"> <center> <h2>Update</h2> </center><hr> <form action="BoqServlet" method="post"> <table class="table table-bordered" style="width:60%; "> <thead> <tr> <th colspan="2"><center>BOQ Update form</center></th> </tr> </thead> <tbody> <input type="hidden" name="id" value="<%=_ID%>"/> <tr> <td>Hsn Code</td> <td><input type="text" name="_hsn_Code" required="required" class="form-control" value="<%= _HsnCode %>"></td> </tr> <tr> <td> HSN code confirmation </td> <td><input type="text" name="_isHSN_CodeConfirmed" required="required" class="form-control" value="<%=_ISHsnCodeConfirmed %>></td> </tr> <tr> <td>GST Rate</td> <td><input type="text" name="_gst_RATE" required="required" class="form-control" value="<%=GST_RATE%>"></td> </tr> <tr> <td>GST Rate Confirmation</td> <td><input type="text" name="GST_rate_Confirmation" required="required" class="form-control" value="<%=IS_GST_RATECONFIRMED %>"></td> </tr> <tr> <td>Item Description</td> <td><input type="text" name="_ItemDesc" required="required" class="form-control" value="<%=item_desc %>"></td> </tr> <tr> <td>Units</td> <td><input type="text" name="_unit_" required="required" class="form-control" value="<%=UNIT %>>"</td> </tr> <tr> <td>Quantity</td> <td><input type="text" name="_QTy" required="required" class="form-control" value="<%=_QTY%>"></td> </tr> <tr> <td>P</td> <td><input type="text" name="_p" required="required" class="form-control" value="<%=_P%>"></td> </tr> <tr> <td>W</td> <td><input type="text" name="__w" required="required" class="form-control" value=<%=W %>></td> </tr> <tr> <td>V</td> <td><input type="text" name="__V" required="required" class="form-control" value="<%=_V%>"></td> </tr> <tr> <td><input type="reset" value="Reset" class="btn btn-info"></td> <td><input type="submit" name="update" value="Update" class="btn btn-primary"></td> </tr> </tbody> </table> </form> </div> </center> <center> <a href="jkpddReport.jsp">View BOQ</a> </center> </body> </html>
-----------Весь стек трассировки-------
&низкотемпературный;%
26: попробуй
27: {
28: _ID = Integer.parseInt(request.getParameter("id"));
29: кон соединение = соединение с БД.параметр "createconnection"();
30: оператор stmt = con.createStatement();
31: ResultSet rst = stmt.executeQuery("select * from boq where id="+_ID+"");
Что я уже пробовал:
я уже пробовал это сделать:
_ID = Integer.parseInt(request.getParameter("id")); Connection con = DBConnection.createConnection(); Statement stmt = con.createStatement(); ResultSet rst = stmt.executeQuery("select * from boq where id="+_ID+""); if(rst.next()) { _HsnCode = rst.getString("hsn_Code"); _ISHsnCodeConfirmed = rst.getString("is_hsnConfirmed"); GST_RATE = rst.getString("gst_rate"); IS_GST_RATECONFIRMED= rst.getString("is_gstRate_confirmed"); item_desc = rst.getString("item_Description"); UNIT = rst.getString("Unit"); _QTY = rst.getString("Qty"); _P = rst.getString("p"); W = rst.getString("w"); _V = rst.getString("v"); _ID = rst.getInt("id"); out.println(rst.getInt("id"));
даже это тоже не сработало.