Html JSP表单没有';行不通
我正在尝试使用一个JSP页面来创建一个对象 这是我的jsp页面:Html JSP表单没有';行不通,html,forms,jsp,spring-mvc,Html,Forms,Jsp,Spring Mvc,我正在尝试使用一个JSP页面来创建一个对象 这是我的jsp页面: <%@taglib uri="http://www.springframework.org/tags/form" prefix="form" %> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Kitsune</title>
</head>
<body>
<div id="wrapper">
<form:form method="POST" action="/Kitsune/formatador/handleNewCv">
<div class="row">
<div class="col-xs-4 text-right">
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
<input class="btn btn-default" name="save" type="submit" value="Save" />
<input class="btn btn-default" name="submitCV" type="submit" value="Submit & Preview" />
</div>
</div>
<div class="row " id="accordion">
<div class="top-info col-xs-12">
<h4>
<a data-toggle="collapse" data-parent="#collapseOne" href="#collapseOne">Address & Contact<i class="indicator fa fa-chevron-up pull-right"></i>
</a>
<div class="clearfix info-cv">
<div class="col-xs-12">
<form role="form">
<div class="form-group">
<form:label path="address">Address</form:label>
<form:input type="text" class="form-control" path="address" />
</div>
</form>
</div>
<div class="col-xs-4">
<form role="form">
<div class="form-group">
<form:label path="postalCode">Postal Code</form:label>
<form:input type="text" class="form-control" path="postalCode" />
</div>
</form>
</div>
</div>
</body>
</html>
当我提交此表单时,控制器中的简历中的所有内容都为null,但如果我删除所有
,则CV对象中会有一些数据。为什么会这样 表单bean声明在JSP中的什么位置?还有,为什么你有这么多表单?你有嵌套表单,这是不允许的。在某些情况下,它是否有效是无关紧要的,因为你不应该依赖于这种行为。你是说我需要从代码中删除所有表单:内容吗?但是我把我的路放在哪里?
@RequestMapping(value = "/handleNewCv", method = RequestMethod.POST, params = {"save", "!submitCV"})
public String saveCV(CurriculumVitae cv, ModelMap model) {
logger.info("saving CV");
model.addAttribute("noteworthy", cv.getNoteworthy());
model.addAttribute("adress", cv.getAddress());
return "formatador/dummyf";
}