Click here to Skip to main content
15,883,922 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
@RequestMapping(value="/create",method = RequestMethod.POST, produces = "text/html")
public String create( Model uiModel, @Valid BillOfMaterial billOfMaterial, BindingResult bindingResult,HttpServletRequest httpServletRequest) {
if (bindingResult.hasErrors()) {
populateEditForm(uiModel, billOfMaterial);
return "billofmaterials/create";
}
uiModel.asMap().clear();
billOfMaterial.persist();
return "redirect:/billofmaterials/";

Problem is Post method not working and data not submitting into database i.e Mysql
Create.jsp

HTML
<section>
	<div class="content-wrapper">
		<h3>
		Form creation<small>Bill Of Materials</small>
		</h3>
		<div class="container-fluid">
			<div class="row">
				<div class="col-lg-12">
					<div class="panel panel-default">
						<div class="panel-heading">
							Form | <small>Bill of materials</small>
						</div>
						<div class="table-responsive">
					<c:url value="/create" var="form"/>
								<form:form action="{$form}" method="POST" modelAttribute="billOfMaterial">
									<table id="datatableBill" class="table table-bordered">
								
										<thead>
												<tr>
													<td>APCPartNumber</td>
													<td><form:input path="apcPartNumber"/></td>
													<td>SubPartNumber</td>
													<td><form:input path="subPartNumber"/></td>
												</tr>
												<tr>
													<td>Description</td>
													<td><form:input path="description"/></td>
													<td>Revisions</td>
													<td><form:input path="revisions"/></td>
												</tr>
												<tr>
													<td>NumberOfSubPartsPerBuyPartNumber</td>
													<td><form:input path="numberOfSubPartsPerBuyPartNumber"/></td>
													<td>Category</td>
													<td><form:input path="category"/></td>
												</tr>
												<tr>
													<td>Raw Material</td>
													<td><form:input path="rawMaterial"/></td>
												</tr>
												<tr>
						                    		<td><input type="submit" value="create" /></td>
						                		</tr>
										</thead>
									</table>
									<!-- <input type="submit" value="create" onClick="buttonpopup"/> -->
									
							</form:form>
						
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</section>
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900