html - form提交表单

时间:2021-04-25 20:04:41

form知识点一:

一般form表单提交onsubmit提交都会有个地址,但是如果没有地址的话会按照当前的页面地址提交:

前端:

fcheck是检查有没有空的标题,

<form method="post" onsubmit="if (!fcheck()) return false;"></form>

后台:

@RequestMapping(value = "/homepage/circle/detail", method = RequestMethod.POST)
	public ModelAndView saveCircle(
			@ModelAttribute("circle") Circle circle, HttpServletRequest request) {
		User user = (User) request.getSession().getAttribute("SESSION_USER");
		if (user == null || !user.hasMakeCoursePermission()) {
			throw new PermissionException("用户没有管理圈子的权限");
		}

		circleDAO.saveCircle(circle);

		return new ModelAndView(new RedirectView("list.html"));
	}