søge og opdater database
I have to handle a project using JSPs and HTML pages and I have tosearch and update a database...
The examples I have been given are mainly separate JSPs for reading
from the database and updating the database.
There are 2 separate pages for updating but I need only 1 page for
updating...I am confused as to how to combine my codes together and
get 1 JSP page for searching, 1 JSP page to display the results and 1
to show that my update is successful...I think what I have done so far
in my ResConfirm page is correct...I still have to come up with the
Searching portion:(
Could any Experts please check and tell me what I have to change and also tell me what has to be in my Search portion?
Thanks
I will Attach The Codes I made so Far Here :
-----------------------------------------------------------
<%@ page import="java.sql.*"%>
<%@ page import="java.util.*"%>
<html>
<head><title>Results</title></head>
<body>
<%@ page import="sc.SCBean"%>
<jsp:useBean id="uBean" scope="session" class="sc.SCBean"/>
<h2 align="center">Results</h2>
<table border=0 width="200" cellspacing=2>
<tr><td>Car No.</td>
<td>Brand</td>
<td>Capacity</td></tr>
<form action="ResConfirm.jsp" method="POST">
<% uBean.connectDb();
int carNo = integer.parseInt(request.getParameter("carNo"));
int j = carNo - 1;
uBean.statementDb("SELECT * FROM CarRec WHERE CarNo="+carNo);
for(int j=0; j<uBean.getSize();j++){ %>
<tr><td><%=uBean.getCarNo(j)%></td>
<td><%=uBean.getBrand(j)%></td>
<td><%=uBean.getCap(j)%></td>
<input type="HIDDEN" name="carNo" value=<%=uBean.getCarNo(j)%>>
<% }
uBean.closeDb(); %>
<td><input type=Submit value="Reserve"></td></tr>
</form>
</table>
</body>
</html>
---------------------------------------------------------------------------
and here Comes the jsp code resconfirm.jsp
<%@ page import="java.sql.*"%>
<%@ page import="java.util.*"%>
<html>
<head><title>Reservation Confirmed</title></head>
<body>
<%@ page import="sc.SCBean"%>
<jsp:useBean id="vBean" scope="session" class="sc.SCBean"/>
<h2 align="center">Reservation Confirmed</h2>
<% vBean.connectDb();
int carNo = integer.parseInt(request.getParameter("carNo"));
int j = carNo - 1;
try{
vBean.statementUpdateDb("IT * FROM CarList WHERE Car No.="+ carNo);
%>
<%
vBean.closeDb();
%>
</table>
</body>
</html>
Pls Help me guys, your more than welcome to write in Danish, As I understand Danish Fully, but unable to write ..
