Skip to content

Commit ed72eca

Browse files
committed
Adding jsp views
1 parent 2f92789 commit ed72eca

File tree

2 files changed

+161
-0
lines changed

2 files changed

+161
-0
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
2+
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
3+
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
4+
<!DOCTYPE html>
5+
<html lang="en">
6+
<head>
7+
<meta charset="utf-8">
8+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
9+
<meta name="viewport" content="width=device-width, initial-scale=1">
10+
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
11+
<meta name="description" content="">
12+
<meta name="author" content="">
13+
14+
<title>File upload demo with Spring framework</title>
15+
16+
<!-- Bootstrap core CSS -->
17+
<link href="${pageContext.request.contextPath}/resources/css/bootstrap.min.css" rel="stylesheet">
18+
19+
<link rel="stylesheet" href="${pageContext.request.contextPath }/resources/css/custom.css" />
20+
</head>
21+
22+
<body>
23+
24+
<div class="container">
25+
<div class="header clearfix">
26+
<nav>
27+
<ul class="nav nav-pills pull-right">
28+
29+
</ul>
30+
</nav>
31+
<h3 class="text-muted">Java Spring MVC</h3>
32+
</div>
33+
34+
<div class="row marketing">
35+
<h3>File upload form with javax/hibernate validations:</h3>
36+
<hr />
37+
<c:if test="${param.success == 1 }">
38+
<div class="alert alert-success">
39+
<a href="${pageContext.request.contextPath }#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
40+
<span class="glyphicon glyphicon-thumbs-up"></span> Your profile information has been successfully saved
41+
</div>
42+
</c:if>
43+
<form:form
44+
action="${pageContext.request.contextPath}/index/saveUser"
45+
enctype="multipart/form-data" method="post" commandName="user">
46+
<div class="form-group">
47+
<label for="name">Firstname</label> <form:errors path="firstName" cssStyle="color:#ff0000;" />
48+
<form:input path="firstName" id="name" name="name" class="form-control" />
49+
</div>
50+
<div class="form-group">
51+
<label for="lastName">Lastname</label> <form:errors path="lastName" cssStyle="color:#ff0000;" />
52+
<form:input path="lastName" id="lastname" name="lastname"
53+
class="form-control"></form:input>
54+
</div>
55+
<div class="form-group">
56+
<label for="age">Age</label> <form:errors path="age" cssStyle="color:#ff0000;" />
57+
<form:input path="age" id="age" name="age"
58+
class="form-control"></form:input>
59+
</div>
60+
<div class="form-group">
61+
<label for="address">Address</label> <form:errors path="address" cssStyle="color:#ff0000;" />
62+
<form:input path="address" id="address" name="address"
63+
class="form-control"></form:input>
64+
</div>
65+
<div class="form-group">
66+
<label class="control-label" for="productImage">Upload Image</label>
67+
<form:input type="file" path="userImage" id="userImage" name="userImage"
68+
class="form:input-large"></form:input>
69+
</div>
70+
<div class="form-group">
71+
<input type="submit" value="Submit" class="btn btn-success" />
72+
</div>
73+
</form:form>
74+
<a href="${pageContext.request.contextPath}/usersList" class="btn btn-primary pull-right">Users</a>
75+
</div>
76+
<div class="row marketing">
77+
78+
</div>
79+
<footer class="footer">
80+
<p>&copy; 2016 Morebodi Rekz Modise. I have left the record editing to you, but if you have tried and still struggle, then halla at me and will upload it</p>
81+
</footer>
82+
83+
</div> <!-- /container -->
84+
</body>
85+
</html>
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
2+
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
3+
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
4+
<!DOCTYPE html>
5+
<html lang="en">
6+
<head>
7+
<meta charset="utf-8">
8+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
9+
<meta name="viewport" content="width=device-width, initial-scale=1">
10+
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
11+
<meta name="description" content="">
12+
<meta name="author" content="">
13+
14+
<title>List of saved users</title>
15+
16+
<!-- Bootstrap core CSS -->
17+
<link href="${pageContext.request.contextPath}/resources/css/bootstrap.min.css" rel="stylesheet">
18+
19+
<link rel="stylesheet" href="${pageContext.request.contextPath }/resources/css/custom.css" />
20+
</head>
21+
22+
<body>
23+
24+
<div class="container">
25+
<div class="header clearfix">
26+
<nav>
27+
<ul class="nav nav-pills pull-right">
28+
29+
</ul>
30+
</nav>
31+
<h3 class="text-muted">Java Spring MVC</h3>
32+
</div>
33+
<div class="row marketing">
34+
<a href="${pageContext.request.contextPath }/" class="btn btn-primary">Back</a><br /><br />
35+
<c:if test="${empty users }">
36+
<div class="alert alert-success">
37+
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
38+
<strong>:(</strong> No users were found
39+
</div>
40+
</c:if>
41+
<c:if test="${param.delete == 1 }">
42+
<div class="alert alert-danger">
43+
<a href="${pageContext.request.contextPath}/usersList#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
44+
<span class="glyphicon glyphicon-thumbs-up"></span> Your profile information has been successfully deleted
45+
</div>
46+
</c:if>
47+
<table class="table table-striped table-hover">
48+
<tr>
49+
<th>Image</th>
50+
<th>Firstname</th>
51+
<th>Lastname</th>
52+
<th>Age</th>
53+
<th>Address</th>
54+
<th>Delete</th>
55+
</tr>
56+
<c:forEach items="${users}" var="user">
57+
<tr>
58+
<td><img src="<c:url value="/resources/uploaded-images/${user.userId}.png"/>" alt="image" class="image"/></td>
59+
<td>${user.userId}</td>
60+
<td>${user.firstName}</td>
61+
<td>${user.lastName }</td>
62+
<td>${user.age }</td>
63+
<td><a href='<c:url value="/index/deleteUser/${user.userId}"/>'><span
64+
class="glyphicon glyphicon-trash"></span></a></td>
65+
</tr>
66+
</c:forEach>
67+
</table>
68+
</div>
69+
70+
<footer class="footer">
71+
<p>&copy; 2016 Morebodi Rekz Modise</p>
72+
</footer>
73+
74+
</div> <!-- /container -->
75+
</body>
76+
</html>

0 commit comments

Comments
 (0)