日期:2014-05-19  浏览次数:21059 次

hibernate保存时重复执行2次,保存了2条数据怎么办啊!
<form action="address.do?method=bikesava" method="post">
<li>提醒时间:<select name="select1">
  <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="15">15</option> <option value="16">16</option><option value="17">17</option><option value="18">18</option> <option value="19">19</option><option value="20">20</option><option value="21">21</option><option value="22">22</option> </select> 时 <select name="select2">
<option value="00">00</option>
<option value="10">10</option>
<option value="20">20</option>
 <option value="30">30</option>
 <option value="40">40</option>
 <option value="50">50</option>
 </select> 分 </li><input type="hidden" name="stationname" value="${stationname.stationname}"/>
 <input type="hidden" name="stationid" value="${stationname.stationid}"/>
 <input type="hidden" name="bustype" value="0"/>
 <input type="hidden" name="mobile" value="${mobile} "/>
<li class="srad"><input type="radio" checked="checked" name="allday" class="sbut" value="1"/>周一至周五 <input type="radio" name="allday" class="sbut" value="0"/>每天</li>
  </ul>
  <div class="syd"><input type="image" src="images/yd.gif" onclick="submit();"/></div>
  </form>

action中的代码是
public ActionForward bikesava(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception {
String select1=request.getParameter("select1");
String select2=request.getParameter("select2");
String stationid=request.getParameter("stationid");//自行车站点编号
String busname= request.getParameter("stationname");//自行车站点名称
String starttime=select1+":"+select2;;//提示时间
String bustype=request.getParameter("bustype");//公交类型1为公交车,0为自行车
String isallday=request.getParameter("allday");//是否为全周的1是全周,0是到周五
String mobile=request.getParameter("mobile").trim();//手机号

Date date=new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmm");
SimpleDateFormat create = new SimpleDateFormat("yyyy-MM-dd HH:mm");
String createtime=create.format(date);
String time=sdf.format(date);
BusinessBook busbook = new BusinessBook();
busbook.setStartTime(starttime);
busbook.setLineName("自行车");
busbook.setStationName(busname);
busbook.setBusinessId(Integer.parseInt(time));
busbook.setCreatetime(createtime);
busbook.setEditTime(createtime);
busbook.setMobile(mobile);
busbook.setSendstatus(0);
busbook.setIs