This section contains JSP view files of the Spring and Hibernate JPA integration application example.
For returning to main example(Spring Jpa Hibernate). Click here.
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<html>
<head><title>Add Article</title></head>
<body>
<h2 style="font-style: italic">Add Article</h2>
<c:url var="viewArticlesUrl" value="/articles.html" />
<a href="${viewArticlesUrl}">Show All Articles</a>
<br></br>
<c:url var="saveArticleUrl" value="/articles/save.html" />
<form:form modelAttribute="article" method="POST" action="${saveArticleUrl}">
<form:label path="articleName">Article Name:</form:label>
<form:input path="articleName" size="46"/>
<br></br>
<form:label path="articleDesc">Article Description:</form:label>
<form:textarea path="articleDesc" rows="3" cols="40"/>
<br />
<input type="submit" value="Save Article" />
</form:form>
</body>
</html>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
<title>Article's List</title>
</head>
<body>
<h2 style="font-style: italic">Article's List</h2>
<a href="articles/add.html">Add Article</a>
<br></br>
<c:if test="${!empty articles}">
<table border="5" width="600">
<tr>
<th>Article ID</th>
<th>Article Name</th>
<th>Article Desc</th>
<th>Added Date</th>
</tr>
<c:forEach items="${articles}" var="article">
<tr>
<td><c:out value="${article.articleId}"/></td>
<td><c:out value="${article.articleName}"/></td>
<td><c:out value="${article.articleDesc}"/></td>
<td><c:out value="${article.addedDate}"/></td>
</tr>
</c:forEach>
</table>
</c:if>
</body>
</html>
|
Recommend the tutorial |
Ask Questions? Discuss: JSP View Files
Post your Comment