film.jsp 1.77 KB
Newer Older
Joel Florentin committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<html>
<head><title>Film</title></head>
<body>
    <form:form action="/film/${film.getId()}" method="post" modelAttribute="film"><br>
        <form:label path="title">Title: </form:label> <form:input type="text" path="title"/><br>
        <form:label path="description">Description: </form:label> <form:textarea path="description" rows="3" cols="20" /><br>
        <form:label path="releaseYear">Release Year: </form:label> <form:input type="numeric" path="releaseYear"/><br>
        <form:select path="lang">
                    <form:options items="${languages}"  itemLabel="name"/>
        </form:select>
        <form:label path="rentalDuration">rental Duration: </form:label> <form:input type="numeric" path="rentalDuration"/><br>
        <form:label path="rentalRate">rental rate: </form:label> <form:input type="numeric" path="rentalRate"/><br>
        <form:label path="length">length: </form:label> <form:input type="numeric" path="length"/><br>
        <form:label path="replacementCost">replacement cost: </form:label> <form:input type="numeric" path="replacementCost"/><br>

        <c:if test = "${film.getId() !=null}"><button id="eliminar">Eliminar</button></c:if>    
        <input type="submit" value="submit"/>
    </form:form>
    <c:forEach items="${film.actors}" var="actor">
            <li>${actor.getFirstName()}</li>
        </c:forEach>
    <c:if test = "${film.getId() !=null}">
        <script>
            document.getElementById("eliminar").addEventListener('click',evt =>{location.assign("/eliminar/${film.getId()}")})
        </script>
      </c:if>
    
</body>
</html>