點(diǎn)批量刪除沒反應(yīng)
Message.xml
dao層
public void deleteBatch(List<Integer> ids){
?? ??? ?try {
?? ??? ??? ?sqlSession = dbAccess.getSqlSession();
?? ??? ??? ?sqlSession.delete("Message.deleteBatch",ids);
?? ??? ??? ?sqlSession.commit();
?? ??? ?} catch (IOException e) {
?? ??? ??? ?e.printStackTrace();
?? ??? ?} finally{
?? ??? ??? ?if(sqlSession!=null){
?? ??? ??? ??? ?sqlSession.close();
?? ??? ??? ?}
?? ??? ?}
service層
public void deleteBatch(String[] ids){
?? ??? ?MessageDao messageDao = new MessageDao();
?? ??? ?List<Integer> idList = new ArrayList<Integer>();
?? ??? ?for (String id : ids) {
?? ??? ??? ?idList.add(Integer.valueOf(id));
?? ??? ?}
?? ??? ?messageDao.deleteBatch(idList);
?? ?}
servlet:
public void doGet(HttpServletRequest request, HttpServletResponse response)
?? ??? ??? ?throws ServletException, IOException {
?? ??? ?String[] ids = request.getParameterValues("id");
?? ??? ?MaintainService ms = new MaintainService();
?? ??? ?ms.deleteBatch(ids);
?? ??? ?request.getRequestDispatcher("/List").forward(request, response);
?? ?}
jsp:
js:
function deleteBatch(basePath) {
?? ?$("#mianForm").attr("action",basePath+"DeleteBatchServlet.action");
?? ?$("#mainForm").submit();
}
實(shí)在不知道哪里錯了,點(diǎn)刪除的時候沒有反應(yīng),地址欄也沒有變化
2017-05-03
我也遇到這個問題,已經(jīng)解決了,
<script src="<%=basePath %>resources/js/common/jquery-1.8.0.min.js"></script>
<script src="<%=basePath %>resources/js/back/list.js"></script>
這個是list.jsp里面的,在js路徑里面要建兩個子文件夾common和back,并把相應(yīng)的js放入文件夾中,我的問題在這,不知道你是否是這樣的
2017-03-21
如果檢查沒有出錯,就把jquery-1.8.0.min.js刪了重新再導(dǎo)入? 然后重啟MyEclipse,就OK了。
2017-02-24
你的js代碼的引用路徑是不是正確的