📄 client2.jsp
字号:
<%-- Document : client2 Created on : Dec 16, 2008, 4:35:40 PM Author : kiriashoo--%><%@page contentType="text/html" pageEncoding="UTF-8"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@ page import="BusinessSessionBeans.*, Entities.*, java.math.*, java.text.*, java.util.*, javax.naming.*" %> <%@ page import = "java.util.StringTokenizer" %><%!private CarSessionBeanRemote carB=null;private RentingSessionBeanRemote bookB=null;List cars ;String antet_car[];int tip=0;public void jspInit(){ try { InitialContext ic= new InitialContext(); bookB=(RentingSessionBeanRemote)ic.lookup(RentingSessionBeanRemote.class.getName()); } catch(Exception e){ System.out.println("couldn't create the bean"+e.getMessage());} try { InitialContext ic= new InitialContext(); carB=(CarSessionBeanRemote)ic.lookup(CarSessionBeanRemote.class.getName()); } catch(Exception e){ System.out.println("couldn't create the bean"+e.getMessage());}}public void jspDestroy(){carB=null;bookB=null;}%><%String startDate=request.getParameter("tStartDate");//if (startDate==null) startDate="1.12.2008";String endDate=request.getParameter("tEndDate");//if (endDate==null) endDate="2.12.2008";//cars = bookB.findAvailableCars(startDate, endDate); cars=carB.findAll();String url=request.getParameterValues("uid")[0];int idUserului=Integer.parseInt(url); int uid=Integer.parseInt(request.getParameter("uid"));int radio=Integer.parseInt(request.getParameter("Radio")); String redirectURL = "ClientServlet?uid="+uid+"&carid="+radio+"&sdate="+startDate+"&edate="+endDate;response.sendRedirect(redirectURL); %><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>User Authentication</title><style type="text/css"><!--.style1 { font-family: Arial, Helvetica, sans-serif; font-size: 24px; color: #FF0000;}.style4 {font-size: 18px}.style6 {font-size: 18px; color: #000000; }--></style></head><body><form id="form1" name="form1" method="post" onSubmit="return OnSubmitForm();"> <div align="center" class="style1"> <p> </p> <p align="center">Car Booking </p> <p> </p> <table width="816" border="0" align="center"> <tr> <td width="308"><label><span class="style6">Start Date</span> <input type="text" name="tStartDate" value=""/> </label></td> <td width="342"><label><span class="style6">EndDate</span> <input type="text" name="tEndDate" value=""/> </label></td> <td width="152"><label> </label></td> </tr> </table> <div align="center"><span class="style6"></span> <input type="submit" name="Find available cars" onClick="document.pressed=this.value" value="Find" /> </div> <p class="style4"> </p> <table width="515" border="1" align="center" cellpadding="0" cellspacing="0"> <tr> <th width="87" class="style6" scope="col">Id </th> <th width="81" class="style3" scope="col"><span class="style6">Make</span> </th> <th width="64" class="style3" scope="col"><span class="style6">Model</span> </th> <th width="91" class="style6" scope="col">Year</th> <th width="180" class="style6" scope="col">PricePerDay</th> </tr> <% if (!cars.equals(null))for (int i = 0; i < cars.size(); i++) { CarEntityBean car=new CarEntityBean(); car=(CarEntityBean)cars.get(i); %> <tr> <td class="style3"><%=car.getId()%> </td> <td class="style3"><%=car.getMake()%> </td> <td class="style3"><%=car.getModel()%> </td> <td class="style3"><%=car.getYearOfFabr()%> </td> <td class="style3"><%=car.getPrice()%> </td> </tr> <%}%> </table> <p> </p> <table width="816" border="0" align="center"> <tr> <td width="308"><label><span class="style6">Id user</span> <input type="text" name="tIdUser" value=<%=idUserului%> disabled="disabled"/> </label></td> <td width="342"><label><span class="style6">Id car</span> <input type="text" name="tIdCar" /> </label></td> <td width="152"><label> </label></td> </tr> </table> <div align="center"><span class="style6"></span> <input type="submit" name="Book" onClick="document.pressed=this.value" value="Book" /> </div> <p> </p> <div align="left"> <input type="submit" name="Logout" onClick="document.pressed=this.value" value="Logout" /> </div></div></form></body></html><SCRIPT language="JavaScript">function OnSubmitForm(){ if(document.pressed == 'Book') { document.form1.action ="client.jsp"; } else if(document.pressed == 'Logout') { document.form1.action ="index.jsp"; } else if(document.pressed == 'Find') { document.form1.action ="client.jsp"; } return true;}</SCRIPT>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -