protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
Transactions trans=new Transactions();
System.out.println(request.getParameter("assetid"));
System.out.println(request.getParameter("barcodeno"));
System.out.println(request.getParameter("location"));
System.out.println(request.getParameter("employeeid"));
System.out.println(request.getParameter("categoryid"));
String categoryId=request.getParameter("categoryid");
String employeeId=request.getParameter("employeeid");
String Assetid=request.getParameter("assetid");
String locationcode=request.getParameter("locationcode");
long AssetId=Long.parseLong(Assetid);
long categoryid123=Long.parseLong(categoryId);
long employeeid=Long.parseLong(employeeId);
long LocationCode=Long.parseLong(locationcode);
System.out.println("here the employeeId id is"+employeeId);
System.out.println("here the Assetid id is"+Assetid);
trans.setBarcodeno(request.getParameter("barcodeno"));
trans.setLocation(new LocationMaster(LocationCode));
trans.setAssetId(AssetId);
trans.setCategory(new CategoryMaster((categoryid123)));
trans.setEmployee(new EmployeeMaster(employeeid));
//trans.setEquipment(new EquipmentMaster(employeeid));
SessionFactory sessionFactory=HibernateUtil.getSessionFactory();
Session sessionHb=sessionFactory.openSession();
Transaction tx=sessionHb.beginTransaction();
HttpSession session=request.getSession();
sessionHb.save(trans);
System.out.println("transition saved");
tx.commit();
response.sendRedirect("Assetisued.jsp");
//CategoryMaster categorymaster =;
}
以下是我在解析之前得到的值
Asset id=101
Categoryid=1
Barcode =1
Employeeid=10
locationid=1
亲爱的先生,我无法将字符串值解析为 long NumberFormatException
。我能够得到所有字符串值,如图所示。我检查了所有内容,但无法理解到底是什么问题。请检查并给我您的反馈...