You are on page 1of 21

TRAIN INFORMATION

MANGEMENT SYSTEM

This project is developed using Enterprise java


technology, some custom styling is also being used
for better front end experience and for handling of
backend stuff jsp technology is used. This project
displays information about registered trains to user
of the webpage. The project has a user registration
and login for user registration and login, has a train
registration form for registering of trains. The user
can enter the required details to see information
about a train.

8968 SHUKLA ANURAG UMASHANKAR


alert.html: For displaying success messages if train is being registered.

1. <!DOCTYPE html>
2. <html lang="en">
3. <head>
4. <meta charset="utf-8">
5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
6. <meta name="viewport" content="width=device-width, initial-scale=1">
7. <title>Bootstrap Elegant Success Modal</title>
8. <link href="https://fonts.googleapis.com/css?family=Roboto|Varela+Round"
rel="stylesheet">
9. <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
10. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-
awesome/4.7.0/css/font-awesome.min.css">
11. <link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
12. <script
src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
13. <script
src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
14. <style type="text/css">
15. body {
16. font-family: 'Varela Round', sans-serif;
17. }
18. .modal-confirm {
19. color: #434e65;
20. width: 525px;
21. }
22. .modal-confirm .modal-content {
23. padding: 20px;
24. font-size: 16px;
25. border-radius: 5px;
26. border: none;
27. }
28. .modal-confirm .modal-header {
29. background: #47c9a2;
30. border-bottom: none;
31. position: relative;
32. text-align: center;
33. margin: -20px -20px 0;
34. border-radius: 5px 5px 0 0;
35. padding: 35px;
36. }
37. .modal-confirm h4 {
38. text-align: center;
39. font-size: 36px;
40. margin: 10px 0;
41. }
42. .modal-confirm .form-control, .modal-confirm .btn {
43. min-height: 40px;
44. border-radius: 3px;
45. }
46. .modal-confirm .close {
47. position: absolute;
48. top: 15px;
49. right: 15px;
50. color: #fff;
51. text-shadow: none;
52. opacity: 0.5;
53. }
54. .modal-confirm .close:hover {
55. opacity: 0.8;
56. }
57. .modal-confirm .icon-box {
58. color: #fff;
59. width: 95px;
60. height: 95px;
61. display: inline-block;
62. border-radius: 50%;
63. z-index: 9;
64. border: 5px solid #fff;
65. padding: 15px;
66. text-align: center;
67. }
68. .modal-confirm .icon-box i {
69. font-size: 64px;
70. margin: -4px 0 0 -4px;
71. }
72. .modal-confirm.modal-dialog {
73. margin-top: 80px;
74. }
75. .modal-confirm .btn {
76. color: #fff;
77. border-radius: 4px;
78. background: #eeb711;
79. text-decoration: none;
80. transition: all 0.4s;
81. line-height: normal;
82. border-radius: 30px;
83. margin-top: 10px;
84. padding: 6px 20px;
85. border: none;
86. }
87. .modal-confirm .btn:hover, .modal-confirm .btn:focus {
88. background: #eda645;
89. outline: none;
90. }
91. .modal-confirm .btn span {
92. margin: 1px 3px 0;
93. float: left;
94. }
95. .modal-confirm .btn i {
96. margin-left: 1px;
97. font-size: 20px;
98. float: right;
99. }
100. .trigger-btn {
101. display: inline-block;
102. margin: 100px auto;
103. }
104. </style>
105. </head>
106. <body>
107. <div class="text-center">
108. <!-- Button HTML (to Trigger Modal) -->
109. <a href="#myModal" class="trigger-btn" data-toggle="modal">Click to Open
Success Modal</a>
110. </div>
111.
112. <!-- Modal HTML -->
113. <div id="myModal" class="modal fade">
114. <div class="modal-dialog modal-confirm">
115. <div class="modal-content">
116. <div class="modal-header">
117. <div class="icon-box">
118. <i class="material-icons"></i>
119. </div>
120. <button type="button" class="close" data-
dismiss="modal" aria-hidden="true">×</button>
121. </div>
122. <div class="modal-body text-center">
123. <h4>Great!</h4>
124. <p>Train has been created successfully.</p>
125. <button class="btn btn-success" data-
dismiss="modal"><span>Start Exploring</span> <i class="material-icons"></i></button>
126. </div>
127. </div>
128. </div>
129. </div>
130. </body>
131. </html>
132.
133.
134.

login.html: Contains user login page.

1. <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css"
rel="stylesheet" id="bootstrap-css">
2. <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
3. <script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
4. <!------ Include the above in your HEAD tag ---------->
5.
6. <!DOCTYPE html>
7. <head>
8. <meta charset="UTF-8" />
9. <link rel="stylesheet" type="text/css" href="logincss.css" />
10. </head>
11. <body>
12. <div class="container">
13.
14. <header>
15. <h1>Welcome to <b>Search Your Train</b></h1>
16.
17. </header>
18. <section>
19. <div id="container_demo" >
20. <!-- hidden anchor to stop jump http://www.css3create.com/Astuce-
Empecher-le-scroll-avec-l-utilisation-de-target#wrap4 -->
21. <a class="hiddenanchor" id="toregister"></a>
22. <a class="hiddenanchor" id="tologin"></a>
23. <div id="wrapper">
24. <div id="login" class="animate form">
25. <form action="login" method="get" autocomplete="on">
26. <h1>Log in</h1>
27. <p>
28. <label for="username" class="uname" > Your email or
username </label>
29. <input id="username" name="uname"
required="required" type="text" placeholder="myusername or mymail@mail.com"/>
30. </p>
31. <p>
32. <label for="password" class="youpasswd"> Your
password </label>
33. <input id="password" name="psw" required="required"
type="password" placeholder="eg. X8df!90EO" />
34. </p>
35. <p class="keeplogin">
36. <input
type="checkbox" name="loginkeeping" id="loginkeeping" value="loginkeeping" />
37. <label
for="loginkeeping">Keep me logged in</label>
38. </p>
39. <p class="login button">
40. <button type="submit">Login</button>
41. </p>
42. <p class="change_link">
43. Not a
member yet ?
44. <a
href="#toregister" class="to_register">Join us</a>
45. </p>
46. </form>
47. </div>
48.
49. <div id="register" class="animate form">
50. <form action="registeruser" method="post"autocomplete="on">
51. <h1> Sign up </h1>
52. <p>
53. <label for="usernamesignup" class="uname" >Full
Name</label>
54. <input id="usernamesignup" name="fullname"
required="required" type="text" placeholder="my Full Name" />
55. </p>
56. <p>
57. <label for="emailsignup" class="youmail" > Your
email</label>
58. <input id="emailsignup" name="email"
required="required" type="email" placeholder="mysupermail@mail.com"/>
59. </p>
60. <p>
61. <label for="emailsignup" class="youmail" > Your
phone</label>
62. <input id="phonesignup" name="phno"
required="required" type="text" placeholder="phone number"/>
63. </p>
64. <p>
65. <label for="usernamesignup" class="uname" >User
Name</label>
66. <input id="usernamesignup" name="username"
required="required" type="text" placeholder="mysuperusername" />
67. </p>
68. <p>
69. <label for="passwordsignup" class="youpasswd" >Your
password </label>
70. <input id="passwordsignup" name="password"
required="required" type="password" placeholder="eg. X8df!90EO"/>
71. </p>
72. <p>
73. <label for="passwordsignup_confirm"
class="youpasswd" >Please confirm your password </label>
74. <input id="passwordsignup_confirm"
name="passwordsignup_confirm" required="required" type="password" placeholder="eg.
X8df!90EO"/>
75. </p>
76. <p class="signin button">
77. <input
type="submit" value="Sign up"/>
78. </p>
79. <p class="change_link">
80. Already
a member ?
81. <a
href="Login.html" class="to_register"> Go and log in </a>
82. </p>
83. </form>
84. </div>
85.
86. </div>
87. </div>
88. </section>
89. </div>
90. </body>
91. </html>
92.
train_registration.html: Contains a form for registration of train.

1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"


2. "http://www.w3.org/TR/html4/strict.dtd"
3. >
4. <html lang="en">
5. <style type="text/css">
6. #wrapper {
7. width:450px;
8. margin:0 auto;
9. font-family:Verdana, sans-serif;
10. }
11. legend {
12. color:#0481b1;
13. font-size:16px;
14. padding:0 10px;
15. background:#fff;
16. -moz-border-radius:4px;
17. box-shadow: 0 1px 5px rgba(4, 129, 177, 0.5);
18. padding:5px 10px;
19. text-transform:uppercase;
20. font-family:Helvetica, sans-serif;
21. font-weight:bold;
22. }
23. fieldset {
24. border-radius:4px;
25. background: #fff;
26. background: -moz-linear-gradient(#fff, #f9fdff);
27. background: -o-linear-gradient(#fff, #f9fdff);
28. background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#f9fdff)); /
29. background: -webkit-linear-gradient(#fff, #f9fdff);
30. padding:20px;
31. border-color:rgba(4, 129, 177, 0.4);
32. }
33. input,
34. textarea {
35. color: #373737;
36. background: #fff;
37. border: 1px solid #CCCCCC;
38. color: #aaa;
39. font-size: 14px;
40. line-height: 1.2em;
41. margin-bottom:15px;
42.
43. -moz-border-radius:4px;
44. -webkit-border-radius:4px;
45. border-radius:4px;
46. box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) inset, 0 1px 0 rgba(255, 255, 255,
0.2);
47. }
48. input[type="text"],
49. input[type="password"]{
50. padding: 8px 6px;
51. height: 22px;
52. width:280px;
53. }
54. input[type="text"]:focus,
55. input[type="password"]:focus {
56. background:#f5fcfe;
57. text-indent: 0;
58. z-index: 1;
59. color: #373737;
60. -webkit-transition-duration: 400ms;
61. -webkit-transition-property: width, background;
62. -webkit-transition-timing-function: ease;
63. -moz-transition-duration: 400ms;
64. -moz-transition-property: width, background;
65. -moz-transition-timing-function: ease;
66. -o-transition-duration: 400ms;
67. -o-transition-property: width, background;
68. -o-transition-timing-function: ease;
69. width: 380px;
70.
71. border-color:#ccc;
72. box-shadow:0 0 5px rgba(4, 129, 177, 0.5);
73. opacity:0.6;
74. }
75. input[type="submit"]{
76. background: #222;
77. border: none;
78. text-shadow: 0 -1px 0 rgba(0,0,0,0.3);
79. text-transform:uppercase;
80. color: #eee;
81. cursor: pointer;
82. font-size: 15px;
83. margin: 5px 0;
84. padding: 5px 22px;
85. -moz-border-radius: 4px;
86. border-radius: 4px;
87. -webkit-border-radius:4px;
88. -webkit-box-shadow: 0px 1px 2px rgba(0,0,0,0.3);
89. -moz-box-shadow: 0px 1px 2px rgba(0,0,0,0.3);
90. box-shadow: 0px 1px 2px rgba(0,0,0,0.3);
91. }
92. textarea {
93. padding:3px;
94. width:96%;
95. height:100px;
96. }
97. textarea:focus {
98. background:#ebf8fd;
99. text-indent: 0;
100. z-index: 1;
101. color: #373737;
102. opacity:0.6;
103. box-shadow:0 0 5px rgba(4, 129, 177, 0.5);
104. border-color:#ccc;
105. }
106. .small {
107. line-height:14px;
108. font-size:15px;
109. color:#999898;
110. margin-bottom:3px;
111. }
112. </style>
113. <body>
114. <div id="wrapper">
115. <form action="registertrain" method="post">
116. <fieldset>
117. <legend>Register Train</legend>
118. <div>
119. <input type="text" name="trainno" placeholder="Enter Train No"/>
120. </div>
121. <div>
122. <input type="text" name="trainname" placeholder="Enter Train
Name"/>
123. </div>
124. <div>
125. <input type="text" name="fromstation" placeholder="From Station"/>
126. </div>
127. <div>
128. <input type="text" name="tostation" placeholder="To Station"/>
129. </div>
130. <div>
131. <input type="text" name="departure" placeholder="Departure in
yyyy-MM-dd"/>
132. </div>
133. <div>
134. <input type="text" name="arrival" placeholder="Arrival in yyyy-MM-
dd"/>
135. </div>
136.
137. <input type="submit" name="submit" value="Register"/>
138. </fieldset>
139. </form>
140. </div>
141. </body>
142. </html>
143.
144.

user_registration.jsp: Contains validation and registration logic in java server


pages.

1. <%@ page language="java" contentType="text/html; charset=ISO-8859-1"


2. pageEncoding="ISO-8859-1"%>
3. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
4. <html>
5. <head>
6. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
7. <script>
8. function validate() {
9. var fullname = document.form.fullname.value;
10. var email = document.form.email.value;
11. var username = document.form.username.value;
12. var password = document.form.password.value;
13. var conpassword = document.form.conpassword.value;
14. if (fullname == null || fullname == "") {
15. alert("Full Name can't be blank");
16. return false;
17. } else if (email == null || email == "") {
18. alert("Email can't be blank");
19. return false;
20. } else if (username == null || username == "") {
21. alert("Username can't be blank");
22. return false;
23. } else if (password.length < 6) {
24. alert("Password must be at least 6 characters long.");
25. return false;
26. } else if (password != conpassword) {
27. alert("Confirm Password should match with the Password");
28. return false;
29. }
30. }
31. </script>
32. </head>
33. <style type="text/css">
34. #wrapper {
35. width: 450px;
36. margin: 0 auto;
37. font-family: Verdana, sans-serif;
38. }
39.
40. legend {
41. color: #0481b1;
42. font-size: 16px;
43. padding: 0 10px;
44. background: #fff;
45. -moz-border-radius: 4px;
46. box-shadow: 0 1px 5px rgba(4, 129, 177, 0.5);
47. padding: 5px 10px;
48. text-transform: uppercase;
49. font-family: Helvetica, sans-serif;
50. font-weight: bold;
51. }
52.
53. fieldset {
54. border-radius: 4px;
55. background: #fff;
56. background: -moz-linear-gradient(#fff, #f9fdff);
57. background: -o-linear-gradient(#fff, #f9fdff);
58. background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff),
59. to(#f9fdff)); /
60. background: -webkit-linear-gradient(#fff, #f9fdff);
61. padding: 20px;
62. border-color: rgba(4, 129, 177, 0.4);
63. }
64.
65. input, textarea {
66. color: #373737;
67. background: #fff;
68. border: 1px solid #CCCCCC;
69. color: #aaa;
70. font-size: 14px;
71. line-height: 1.2em;
72. margin-bottom: 15px;
73. -moz-border-radius: 4px;
74. -webkit-border-radius: 4px;
75. border-radius: 4px;
76. box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) inset, 0 1px 0
77. rgba(255, 255, 255, 0.2);
78. }
79.
80. input[type="text"], input[type="password"] {
81. padding: 8px 6px;
82. height: 22px;
83. width: 280px;
84. }
85.
86. input[type="text"]:focus, input[type="password"]:focus {
87. background: #f5fcfe;
88. text-indent: 0;
89. z-index: 1;
90. color: #373737;
91. -webkit-transition-duration: 400ms;
92. -webkit-transition-property: width, background;
93. -webkit-transition-timing-function: ease;
94. -moz-transition-duration: 400ms;
95. -moz-transition-property: width, background;
96. -moz-transition-timing-function: ease;
97. -o-transition-duration: 400ms;
98. -o-transition-property: width, background;
99. -o-transition-timing-function: ease;
100. width: 380px;
101. border-color: #ccc;
102. box-shadow: 0 0 5px rgba(4, 129, 177, 0.5);
103. opacity: 0.6;
104. }
105.
106. input[type="submit"] {
107. background: #00f;
108. border: none;
109. text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
110. text-transform: uppercase;
111. color: #eee;
112. cursor: pointer;
113. font-size: 15px;
114. margin: 5px 0;
115. padding: 5px 22px;
116. -moz-border-radius: 4px;
117. border-radius: 4px;
118. -webkit-border-radius: 4px;
119. -webkit-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.3);
120. -moz-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.3);
121. box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.3);
122. }
123.
124. input[type="reset"] {
125. background: #222;
126. border: none;
127. text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
128. text-transform: uppercase;
129. color: #eee;
130. cursor: pointer;
131. font-size: 15px;
132. margin: 5px 0;
133. padding: 5px 22px;
134. -moz-border-radius: 4px;
135. border-radius: 4px;
136. -webkit-border-radius: 4px;
137. -webkit-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.3);
138. -moz-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.3);
139. box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.3);
140. }
141.
142. textarea {
143. padding: 3px;
144. width: 96%;
145. height: 100px;
146. }
147.
148. textarea:focus {
149. background: #ebf8fd;
150. text-indent: 0;
151. z-index: 1;
152. color: #373737;
153. opacity: 0.6;
154. box-shadow: 0 0 5px rgba(4, 129, 177, 0.5);
155. border-color: #ccc;
156. }
157.
158. .small {
159. line-height: 14px;
160. font-size: 15px;
161. color: #999898;
162. margin-bottom: 3px;
163. }
164. </style>
165. <body>
166. <div id="wrapper">
167. <form name='form' action="registeruser" method="post"
168. onsubmit="return validate()">
169. <fieldset>
170. <legend>Register User</legend>
171. <div>
172. <input type="text" name="fullname"
placeholder="Enter Full Name" />
173. </div>
174. <div>
175. <input type="text" name="email"
placeholder="Enter Email" />
176. </div>
177. <div>
178. <input type="text" name="phno"
placeholder="Enter Phone No" />
179. </div>
180. <div>
181. <input type="text" name="username"
placeholder="Enter Username" />
182. </div>
183. <div>
184. <input type="password"
name="password" placeholder="Enter Password" />
185. </div>
186. <div>
187. <input type="password"
name="conpassword"
188. placeholder="Confirm
Password" />
189. </div>
190.
191. <input type="submit" name="submit"
value="Register" /> <input
192. type="reset" value="Reset"></input>
193.
194. </fieldset>
195. </form>
196. </div>
197.
198.
199. </body>
200. </html>
201.

Welcome.jsp: Contains welcome page for of the app when user logs in
successfully.

1. <%@ page language="java" contentType="text/html; charset=ISO-8859-1"


2. pageEncoding="ISO-8859-1"%>
3. <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
4. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
5. <html>
6. <head>
7. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
8.
9. <script>
10. function validate() {
11. var trainno = document.searchForm.trainno.value;
12.
13. if (trainno == null || trainno == "") {
14. alert("Train Number can't be blank");
15. return false;
16. }
17. }
18. </script>
19. </head>
20. <body>
21. <div>
22. <%
23. String user=(String)session.getAttribute("user");
24. %>
25. <H3>Welcome! <b style='color:blue'><i>${user}</i></b></H3>
26. </div>
27. <div>
28. <form action="trainlist" >
29. <input type="submit" name="button1" value="view trains" />
30. <input type='hidden' name='show' value='true'>
31. </form>
32. <form action="trainbyno" name="searchForm" onsubmit="return validate()">
33. <input type='hidden' name='show' value='true'>
34. <input type="text" name="trainno" placeholder="Search trains " />
35. <input type="submit" value="Search trains " />
36. </form>
37. </div>
38. <div>
39. <c:choose>
40. <c:when test="${param.show == true}">
41. <jsp:include page="view_train_list.jsp" />
42. </c:when>
43. </c:choose>
44. </div>
45. </body>
46. </html>
47.

view_train_list.jsp: Contains the logic for viewing the trains registered in


database.

1. <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>


2. <!DOCTYPE html>
3. <html lang="en">
4. <head>
5. <meta charset="utf-8">
6. <meta http-equiv="X-UA-Compatible" content="IE=edge">
7. <meta name="viewport" content="width=device-width, initial-scale=1">
8. <link rel="stylesheet"
9. href="https://fonts.googleapis.com/css?family=Roboto|Varela+Round">
10. <link rel="stylesheet"
11. href="https://fonts.googleapis.com/icon?family=Material+Icons">
12. <link rel="stylesheet"
13. href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
14. <link rel="stylesheet"
15. href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
16. <script
17. src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
18. <script
19. src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
20. <style type="text/css">
21. body {
22. color: #566787;
23. background: #f5f5f5;
24. font-family: 'Varela Round', sans-serif;
25. font-size: 13px;
26. }
27.
28. .table-wrapper {
29. background: #fff;
30. padding: 20px 25px;
31. margin: 30px 0;
32. border-radius: 3px;
33. box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
34. }
35.
36. .table-title {
37. padding-bottom: 15px;
38. background: #435d7d;
39. color: #fff;
40. padding: 16px 30px;
41. margin: -20px -25px 10px;
42. border-radius: 3px 3px 0 0;
43. }
44.
45. .table-title h2 {
46. margin: 5px 0 0;
47. font-size: 24px;
48. }
49.
50. .table-title .btn-group {
51. float: right;
52. }
53.
54. .table-title .btn {
55. color: #fff;
56. float: right;
57. font-size: 13px;
58. border: none;
59. min-width: 50px;
60. border-radius: 2px;
61. border: none;
62. outline: none !important;
63. margin-left: 10px;
64. }
65.
66. .table-title .btn i {
67. float: left;
68. font-size: 21px;
69. margin-right: 5px;
70. }
71.
72. .table-title .btn span {
73. float: left;
74. margin-top: 2px;
75. }
76.
77. table.table tr th, table.table tr td {
78. border-color: #e9e9e9;
79. padding: 12px 15px;
80. vertical-align: middle;
81. }
82.
83. table.table tr th:first-child {
84. width: 60px;
85. }
86.
87. table.table tr th:last-child {
88. width: 100px;
89. }
90.
91. table.table-striped tbody tr:nth-of-type(odd) {
92. background-color: #fcfcfc;
93. }
94.
95. table.table-striped.table-hover tbody tr:hover {
96. background: #f5f5f5;
97. }
98.
99. table.table th i {
100. font-size: 13px;
101. margin: 0 5px;
102. cursor: pointer;
103. }
104.
105. table.table td:last-child i {
106. opacity: 0.9;
107. font-size: 22px;
108. margin: 0 5px;
109. }
110.
111. table.table td a {
112. font-weight: bold;
113. color: #566787;
114. display: inline-block;
115. text-decoration: none;
116. outline: none !important;
117. }
118.
119. table.table td a:hover {
120. color: #2196F3;
121. }
122.
123. table.table td a.edit {
124. color: #FFC107;
125. }
126.
127. table.table td a.delete {
128. color: #F44336;
129. }
130.
131. table.table td i {
132. font-size: 19px;
133. }
134.
135. table.table .avatar {
136. border-radius: 50%;
137. vertical-align: middle;
138. margin-right: 10px;
139. }
140.
141. .pagination {
142. float: right;
143. margin: 0 0 5px;
144. }
145.
146. .pagination li a {
147. border: none;
148. font-size: 13px;
149. min-width: 30px;
150. min-height: 30px;
151. color: #999;
152. margin: 0 2px;
153. line-height: 30px;
154. border-radius: 2px !important;
155. text-align: center;
156. padding: 0 6px;
157. }
158.
159. .pagination li a:hover {
160. color: #666;
161. }
162.
163. .pagination li.active a, .pagination li.active a.page-link {
164. background: #03A9F4;
165. }
166.
167. .pagination li.active a:hover {
168. background: #0397d6;
169. }
170.
171. .pagination li.disabled i {
172. color: #ccc;
173. }
174.
175. .pagination li i {
176. font-size: 16px;
177. padding-top: 6px
178. }
179.
180. .hint-text {
181. float: left;
182. margin-top: 10px;
183. font-size: 13px;
184. }
185. /* Custom checkbox */
186. .custom-checkbox {
187. position: relative;
188. }
189.
190. .custom-checkbox input[type="checkbox"] {
191. opacity: 0;
192. position: absolute;
193. margin: 5px 0 0 3px;
194. z-index: 9;
195. }
196.
197. .custom-checkbox label:before {
198. width: 18px;
199. height: 18px;
200. }
201.
202. .custom-checkbox label:before {
203. content: '';
204. margin-right: 10px;
205. display: inline-block;
206. vertical-align: text-top;
207. background: white;
208. border: 1px solid #bbb;
209. border-radius: 2px;
210. box-sizing: border-box;
211. z-index: 2;
212. }
213.
214. .custom-checkbox input[type="checkbox"]:checked+label:after {
215. content: '';
216. position: absolute;
217. left: 6px;
218. top: 3px;
219. width: 6px;
220. height: 11px;
221. border: solid #000;
222. border-width: 0 3px 3px 0;
223. transform: inherit;
224. z-index: 3;
225. transform: rotateZ(45deg);
226. }
227.
228. .custom-checkbox input[type="checkbox"]:checked+label:before {
229. border-color: #03A9F4;
230. background: #03A9F4;
231. }
232.
233. .custom-checkbox input[type="checkbox"]:checked+label:after {
234. border-color: #fff;
235. }
236.
237. .custom-checkbox input[type="checkbox"]:disabled+label:before {
238. color: #b8b8b8;
239. cursor: auto;
240. box-shadow: none;
241. background: #ddd;
242. }
243. /* Modal styles */
244. .modal .modal-dialog {
245. max-width: 400px;
246. }
247.
248. .modal .modal-header, .modal .modal-body, .modal .modal-footer {
249. padding: 20px 30px;
250. }
251.
252. .modal .modal-content {
253. border-radius: 3px;
254. }
255.
256. .modal .modal-footer {
257. background: #ecf0f1;
258. border-radius: 0 0 3px 3px;
259. }
260.
261. .modal .modal-title {
262. display: inline-block;
263. }
264.
265. .modal .form-control {
266. border-radius: 2px;
267. box-shadow: none;
268. border-color: #dddddd;
269. }
270.
271. .modal textarea.form-control {
272. resize: vertical;
273. }
274.
275. .modal .btn {
276. border-radius: 2px;
277. min-width: 100px;
278. }
279.
280. .modal form label {
281. font-weight: normal;
282. }
283. </style>
284. <script type="text/javascript">
285.
286. function myFunction() {
287. var x = document.getElementById("did1").value;
288. y=document.getElementById("did2").innerHtml = x;
289. alert(y);
290.
291.
292. //var Row = document.getElementById("rid");
293. //var Cells = Row.getElementsByTagName("td");
294. //alert(Cells[0].innerText);rows[1].cells[1].
295. //var x=document.getElementById("rid").innerText;
296. //var table = document.getElementById("rid");
297.
298. //alert(table.rows[1].cells[1].innerHTML);
299. // alert(x);
300.
301. }
302. $(document).ready(function() {
303. // Activate tooltip
304. $('[data-toggle="tooltip"]').tooltip();
305.
306. // Select/Deselect checkboxes
307. var checkbox = $('table tbody input[type="checkbox"]');
308. $("#selectAll").click(function() {
309. if (this.checked) {
310. checkbox.each(function() {
311. this.checked = true;
312. });
313. } else {
314. checkbox.each(function() {
315. this.checked = false;
316. });
317. }
318. });
319. checkbox.click(function() {
320. if (!this.checked) {
321. $("#selectAll").prop("checked", false);
322. }
323. });
324. });
325. </script>
326. </head>
327. <body>
328. <div class="container">
329. <div class="table-wrapper">
330. <div class="table-title">
331. <div class="row">
332. <div class="col-sm-6">
333. <h2>
334. <b>Train List</b>
335. </h2>
336. </div>
337. <div class="col-sm-6">
338. <a href="#addTrainModal"
class="btn btn-success"
339. data-
toggle="modal"><i class="material-icons"></i> <span>Add
340. New
Train</span></a> <a href="#deleteEmployeeModal" class="btn btn-danger"
341. data-
toggle="modal"><i class="material-icons"></i> <span>Delete</span></a>
342. </div>
343. </div>
344. </div>
345. <table class="table table-striped table-hover">
346.
347. <tbody>
348. <c:choose>
349. <c:when test="${trainList
ne null }">
350.
351. <thead>
352. <tr>
353.
<th><span class="custom-checkbox"> <input
354.
type="checkbox" id="selectAll"> <label
355.
for="selectAll"></label>
356.
</span></th>
357.
<th>Train Number</th>
358.
<th>Train Name</th>
359.
<th>From Station</th>
360.
<th>To Station</th>
361.
<th>Departure</th>
362.
<th>Arrival</th>
363.
<th>Action</th>
364. </tr>
365. </thead>
366. <c:forEach
var="trainList" items="${trainList }">
367. <tr
id="rid">
368.
<td><span class="custom-checkbox"> <input
369.
type="checkbox" id="checkbox1" name="options[]" value="1">
370.
<label for="checkbox1"></label>
371.
</span></td>
372.
<td>${trainList.trainno}</td>
373.
<td>${trainList.trainname}</td>
374.
<td>${trainList.fromstation}</td>
375.
<td>${trainList.tostation}</td>
376.
<td>${trainList.departure}</td>
377.
<td>${trainList.arrival}</td>
378.
<td><input type ="hidden" id="did1" value="${trainList.trainno}"/></td>
379.
<td>
380.
<a href="#editTrainModal" class="edit"
381.
data-toggle="modal"><i class="material-icons"
382.
data-toggle="tooltip" title="Edit"></i></a> <a
383.
href="#deleteTrainModal" class="delete" data-toggle="modal"
onclick="myFunction()" >
384.
<i class="material-icons" data-toggle="tooltip" title="Delete" ></i></a>
385.
</td>
386. </tr>
387. </c:forEach>
388. <%-- <input type
="hidden" name="id" id="did1" value="${trainList.trainno}"/> --%>
389. </table>
390.
391. </c:when>
392. <c:otherwise>
393. <h1 style="color: red">No Train Found</h1>
394. </c:otherwise>
395. </c:choose>
396.
397. </tbody>
398. </table>
399. <div class="clearfix">
400. <div class="hint-text">
401. Showing <b>5</b> out of <b>25</b>
entries
402. </div>
403. <ul class="pagination">
404. <li class="page-item disabled"><a
href="#">Previous</a></li>
405. <li class="page-item"><a href="#"
class="page-link">1</a></li>
406. <li class="page-item"><a href="#"
class="page-link">2</a></li>
407. <li class="page-item active"><a
href="#" class="page-link">3</a></li>
408. <li class="page-item"><a href="#"
class="page-link">4</a></li>
409. <li class="page-item"><a href="#"
class="page-link">5</a></li>
410. <li class="page-item"><a href="#"
class="page-link">Next</a></li>
411. </ul>
412. </div>
413. </div>
414. </div>
415. <!-- Edit Modal HTML -->
416. <div id="addTrainModal" class="modal fade">
417. <div class="modal-dialog">
418. <div class="modal-content">
419. <form action="registertrain" method="post">
420. <div class="modal-header">
421. <h4 class="modal-title">Add
Train</h4>
422. <button type="button"
class="close" data-dismiss="modal" aria-hidden="true">×</button>
423. </div>
424. <div class="modal-body">

425. <div >


426. <label>Train
Number</label>
427. <input type="text"
class="form-control" name='trainno' required>
428. </div>
429. <div >
430. <label>Train
Name</label>
431. <input type="text"
class="form-control" name='trainname' required>
432. </div>
433. <div >
434. <label>From
Station</label>
435. <input type="text"
class="form-control" name='fromstation' required></textarea>
436. </div>
437. <div >
438. <label>To
Station</label>
439. <input type="text"
class="form-control" name='tostation' required>
440. </div>
441. <div >
442.
<label>Departure</label>
443. <input type="text"
class="form-control" name='departure' required>
444. </div>
445. <div >
446.
<label>Arrival</label>
447. <input type="text"
class="form-control" name='arrival' required>
448. </div>

449. </div>
450. <div class="modal-footer">
451. <input type="button"
class="btn btn-default" data-dismiss="modal" value="Cancel">
452. <input type="submit"
class="btn btn-success" value="Add">
453. </div>
454. </form>
455. </div>
456. </div>
457. </div>
458. <!-- Edit Modal HTML -->
459. <div id="editTrainModal" class="modal fade">
460. <div class="modal-dialog">
461. <div class="modal-content">
462. <form>
463. <div class="modal-header">

464. <h4 class="modal-


title">Edit Train</h4>
465. <button type="button"
class="close" data-dismiss="modal" aria-hidden="true">×</button>
466. </div>
467. <div class="modal-body">

468. <div class="form-group">


469. <label>Train
Number</label>
470. <input type="text"
class="form-control" required>
471. </div>
472. <div class="form-group">
473. <label>Train
Name</label>
474. <input type="text"
class="form-control" required>
475. </div>
476. <div class="form-group">
477. <label>From
Station</label>
478. <input type="text"
class="form-control" required></textarea>
479. </div>
480. <div class="form-group">
481. <label>To
Station</label>
482. <input type="text"
class="form-control" required>
483. </div>
484. <div class="form-group">
485.
<label>Departure</label>
486. <input type="text"
class="form-control" required>
487. </div>
488. <div class="form-group">
489.
<label>Arrival</label>
490. <input type="text"
class="form-control" required>
491. </div>

492. </div>
493. <div class="modal-footer">
494. <input type="button"
class="btn btn-default" data-dismiss="modal" value="Cancel">
495. <input type="submit"
class="btn btn-info" value="Save">
496. </div>
497. </form>
498. </div>
499. </div>
500. </div>
501. <!-- Delete Modal HTML -->
502. <div id="deleteTrainModal" class="modal fade">
503. <div class="modal-dialog">
504. <div class="modal-content">
505. <form action="deletetrainbyno" method="post">
506. <div class="modal-header">
507. <h4 class="modal-title">Delete
Train</h4>
508. <button type="button"
class="close" data-dismiss="modal" aria-hidden="true" ">×</button>
509. </div>
510. <div class="modal-body">

511. <p>Are you sure you want to


delete these Train?</p>
512. <p class="text-
warning"><small>This action cannot be undone.</small></p>
513. </div>
514. <input type ="hidden" name="id"
id="did2" />
515.

516. <div class="modal-footer">


517. <input type="button"
class="btn btn-default" data-dismiss="modal" value="Cancel">
518. <input type="submit"
class="btn btn-danger" value="Delete" >
519. </div>
520.
521. </form>
522. </div>
523. </div>
524. </div>
525.
526.
527. </body>
528. </html>
529.
530.
531.

You might also like