问答详情
源自:4-4 实现单条信息删除

可以删除单条数据,不能再返回列表页面,我使用的是Spring MVC

这是控制台的日志,没问题:

DEBUG [org.apache.ibatis.transaction.jdbc.JdbcTransaction] - Opening JDBC Connection

DEBUG [org.apache.ibatis.transaction.jdbc.JdbcTransaction] - Setting autocommit to false on JDBC Connection [com.mysql.jdbc.Connection@1c0e2dd]

DEBUG [Message.deleteOne] - ==>  Preparing: delete from message where ID = ? 

DEBUG [Message.deleteOne] - ==> Parameters: 6(Integer)

DEBUG [Message.deleteOne] - <==    Updates: 1

DEBUG [org.apache.ibatis.transaction.jdbc.JdbcTransaction] - Committing JDBC Connection [com.mysql.jdbc.Connection@1c0e2dd]

DEBUG [org.apache.ibatis.transaction.jdbc.JdbcTransaction] - Resetting autocommit to true on JDBC Connection [com.mysql.jdbc.Connection@1c0e2dd]

DEBUG [org.apache.ibatis.transaction.jdbc.JdbcTransaction] - Closing JDBC Connection [com.mysql.jdbc.Connection@1c0e2dd]

DEBUG [org.springframework.web.servlet.DispatcherServlet] - Rendering view [org.springframework.web.servlet.view.JstlView: name 'WEB-INF/jsp/back/messageList'; URL [/WEB-INF/jsp/back/messageList.jsp]] in DispatcherServlet with name 'springmvc09'

DEBUG [org.springframework.web.servlet.view.JstlView] - Forwarding to resource [/WEB-INF/jsp/back/messageList.jsp] in InternalResourceView 'WEB-INF/jsp/back/messageList'

DEBUG [org.springframework.web.servlet.DispatcherServlet] - Successfully completed request


Controller.java

@Controller
@RequestMapping("/weixin")
public class WeixinController {
    @RequestMapping(value = "/messageDeleteOne")
    public String messageDeleteOne(HttpServletRequest request, Model model) {
	//接受页面传回的值
	String id = request.getParameter("id");
	MaintainService maintainService = new MaintainService();
	maintainService.deleteOne(id);
	request.getRequestDispatcher("weixin/messageList.do");

	return "WEB-INF/jsp/back/messageList";

    }

}

这是删除单条之后的记录,跳转不回来,特来请教

http://img.mukewang.com/575823c80001aa2709400293.jpg

提问者:达仓 2016-06-08 21:56

个回答

  • 违丶心
    2016-08-04 15:27:09
    已采纳

    .forword()

  • 慕前端4905215
    2016-06-09 00:08:04

    使用重定向