魅惑2.0 2017-04-17 12:23 采纳率: 33.3%
浏览 9372

for input String :""怎么解决?

try {
int auctionid = Integer.parseInt(request.getParameter("auctionid").trim()) ;
Double price=Double.parseDouble(request.getParameter("auctionPrice"));
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
Date date = Calendar.getInstance().getTime();
String time=sdf.format(date);
Integer userId = ((Auctionuser)request.getSession().getAttribute("user")).getUserid();
Auctionrecord auct =new Auctionrecord();
Auction auction =new Auction();
auction.setAuctionid(new Integer(auctionid));
Auctionuser user =new Auctionuser();
user.setUserid(userId);

auct.setAuctionId(auctionid);
auct.setAuctionuser(user);
auct.setAuctiontime(sdf.parse(time));
auct.setAuctionprice(price);

            int num= service.AddAuct(auct);  
                if (num>0){
                    out.print(
                            "<script type=\"text/javascript\">"+
                            "alert(\"竞拍成功!!!\");"+
                            "location.href=\"AuctionrecordServlet?opr=auctor&id=1\";"+
                        "</script>"
                    );
                }else {
                    out.print(
                            "<script type=\"text/javascript\">"+
                            "alert(\"竞拍失败!!!\");"+
                            "location.href=\"AuctionrecordServlet?opr=auctor&id=1\";"+
                        "</script>"
                    );
                }
        } catch (Exception e) {
            e.printStackTrace();
        }

}

  • 写回答

1条回答

  • threenewbee 2017-04-17 15:49
    关注
    评论

报告相同问题?

问题事件

  • 提问应符合社区要求 10月27日

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog