-
Antoine Rey authoredAntoine Rey authored
createOrUpdatePetForm.jsp 2.09 KiB
<%@ page session="false" trimDirectiveWhitespaces="true" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %>
<petclinic:layout pageName="owners">
<jsp:attribute name="customScript">
<script>
$(function () {
$("#birthDate").datepicker({dateFormat: 'yy/mm/dd'});
});
</script>
</jsp:attribute>
<jsp:body>
<h2>
<c:if test="${pet['new']}">New </c:if> Pet
</h2>
<form:form modelAttribute="pet"
class="form-horizontal">
<input type="hidden" name="id" value="${pet.id}"/>
<div class="form-group has-feedback">
<div class="form-group">
<label class="col-sm-2 control-label">Owner</label>
<div class="col-sm-10">
<c:out value="${pet.owner.firstName} ${pet.owner.lastName}"/>
</div>
</div>
<petclinic:inputField label="Name" name="name"/>
<petclinic:inputField label="Birth Date" name="birthDate"/>
<div class="control-group">
<petclinic:selectField name="type" label="Type " names="${types}" size="5"/>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<c:choose>
<c:when test="${pet['new']}">
<button class="btn btn-default" type="submit">Add Pet</button>
</c:when>
<c:otherwise>
<button class="btn btn-default" type="submit">Update Pet</button>
</c:otherwise>
</c:choose>
</div>
</div>
</form:form>
<c:if test="${!pet['new']}">
</c:if>
</jsp:body>
</petclinic:layout>