-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreturn_book.jsp
45 lines (40 loc) · 2.47 KB
/
return_book.jsp
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
33
34
35
36
37
38
39
40
41
42
43
44
45
<%@include file="common/header.jsp" %>
<%@page import="java.sql.*,java.util.*"%>
<div class="w3-container">
<div class="w3-col" style="width: 10%"> </div>
<div class="w3-col" style="width: 80%">
<% String userid=request.getParameter("userid"); %>
<!-- <label class="w3-label"><% out.println("Welcome : "+userid);%></label>-->
<% Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection("jdbc:mysql://127.0.0.1/login", "root", "");
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery("select * from new_table where username='" + userid + "'");
if (rs.next()) {
%>
<h3 class="w3-text"><center><u>Welcome To Charusat Library Website</u></center></h3>
<br><br><label> Name : <%= rs.getString("first_name")%>
<%= rs.getString("last_name") %></label><br>
<label> Registration No: <%= rs.getString("username").toUpperCase() %>
<br><br><label class="w3-label">Issue Book From Here.....</label>
<form class="w3-form" method="post" action="return.jsp"><br><br>
<input type="hidden" name="userid" value="<%= rs.getString("username") %>">
<input type="hidden" name="email" value="<%= rs.getString("email") %>">
<input class="w3-input" name="bookname1" placeholder="Enter ID of Book1" required><br>
<input class="w3-input" name="bookname2" placeholder="Enter ID of Book2" ><br>
<input class="w3-input" name="bookname3" placeholder="Enter ID of Book3" ><br>
<input class="w3-input" name="bookname4" placeholder="Enter ID of Book4" ><br>
<input type="hidden" name="flag" value="1">
<button class="w3-btn w3-blue" type="submit">Issue Book</button>
</form>
</div>
<div class="w3-col" style="width: 10%"> </div>
</div>
<%
}
else
{
request.setAttribute("errorMessage", "Invalid User ID");
RequestDispatcher dispatcher = request.getRequestDispatcher("returnbook.jsp");
dispatcher.forward( request, response);
}
%>