Springmvc的controller返回的modelAndView(jsonSuccess)里面的地址根本不存在啊?



 @RequestMapping(value = "/add", method = RequestMethod.POST)
    public ModelAndView add(HttpServletRequest request,
            HttpServletResponse response, ZqbpCommonSerlect item) {
        ConnectionSource connectionSource = DBUtil.getConnectionSource();
        try {
            Dao<ZqbpCommonSerlect, String> dao = DaoManager.createDao(connectionSource,
                    ZqbpCommonSerlect.class);
            item.setSelectId(UUID.randomUUID().toString().replaceAll("-", ""));

            dao.create(item);
            connectionSource.close();
        } catch (SQLException e) {
            return jsonError(request, "保存失败", "");
        }
        return jsonSuccess(request, "保存成功!", getBasePath(request)+ "admin/chanpin/index.html");

《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《《

图片描述

为什么还能正常打开?是不是这个地址并不是modelAndView数据所传递的地址?

spring-mvc java javaweb JSP

旺仔牛奶丶 9 years, 6 months ago

当然是传给视图,这个modelandview对象就是controller处理后返回的赛

爱罗伊子爵 answered 9 years, 6 months ago

看看你这个Controller是否有父类,有的话看看父类里是否有这个方法。。。用编辑器也可以直接跳转啊

德国boy  answered 9 years, 6 months ago

Your Answer