jeudi 26 février 2015

Bootstrap 3.2 won't style Spring MVC form:form

I have a simple Spring MVC 4.x (tiles) scenario. Where in response to a URI a form is displayed, however, Bootstrap styling is not kicking in:


JSP:



<%@ taglib uri="http://ift.tt/QfKAz6" prefix="c"%>
<%@ taglib uri="http://ift.tt/IED0jK" prefix="form"%>
<br/><br/><br/>
<form:form modelAttribute="car" method="post">
<div class="form-group">
<label for="title">Make</label>
<form:input path="make"/>
</div>
<div class="form-group">
<label for="isbn">Model (Long Label)</label>
<form:input path="model"/>
</div>
<div class="form-group">
<label for="isbn">Color</label>
<form:input path="color"/>
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form:form>


Rendered HTML:



<body>
<div class="container">
<div class="row">
<div class="header">

</div>
<div id="main-content-container">
<!-- main body -->



<br/><br/><br/>
<form id="car" action="/libms/carsx" method="post">
<div class="form-group">
<label for="title">Make</label>
<input id="make" name="make" type="text" value=""/>
</div>
<div class="form-group">
<label for="isbn">Model (Long Label)</label>
<input id="model" name="model" type="text" value=""/>
</div>
<div class="form-group">
<label for="isbn">Color</label>
<input id="color" name="color" type="text" value=""/>
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
</div>
<div class="footer">

</div>
</div>
</div>
</body>


Looks like this on screen: enter image description here


I have verified if Spring's form:form is removed and <form> is used instead, the styling kicks in.


Aucun commentaire:

Enregistrer un commentaire