⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 client.jsp

📁 Java Application using EJB 3.0 for renting a car - Entities : Car, User, Renting Business Logic. Ne
💻 JSP
字号:
<%@page contentType="text/html"%><%@page pageEncoding="UTF-8"%><%--    - I. Salomie, T. Cioara, I. Anghel, T.Salomie - Distributed Computing and Systems. A Practical Approach    - Albastra Publish House, 2008, ISBN 978-973-650-234-7    - Chapter 3 - Component-based Systems   -   - File Name: client.jsp --%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"   "http://www.w3.org/TR/html4/loose.dtd"><%@ page import="BusinessSessionBeans.RentingSessionBeanRemote,utils.Utils,java.text.ParseException,java.text.SimpleDateFormat,java.sql.Timestamp,java.util.*,java.sql.Date,java.text.*,java.math.*, javax.naming.*"%> <%!   private RentingSessionBeanRemote bookBean;      public void jspInit() {      try {          InitialContext ic = new InitialContext();          bookBean = (RentingSessionBeanRemote) ic.lookup(RentingSessionBeanRemote.class.getName());      }       catch (Exception ex) {          System.out.println("Erorr when creating the bean"+          ex.getMessage());      }   }    public void jspDestroy() {      bookBean = null;   }%>   <%     try {        if(request.getParameter("OP").equals("Book")) {              try {              Utils ut=new Utils();              String bds=request.getParameter("bsdate");              String bde=request.getParameter("bedate");              if(ut.verifyDate(bds)==0){%><SCRIPT LANGUAGE="JavaScript">   alert ("Wrong data format for start date booking! Look in the console"); </SCRIPT><%                  }              if(ut.verifyDate(bde)==0)              {%><SCRIPT LANGUAGE="JavaScript">   alert ("Wrong data format for end date booking! Look in the console"); </SCRIPT><%              }              bds=ut.convertDate(bds);              bde=ut.convertDate(bde);              bookBean.create(Integer.parseInt(request.getParameter("uid")),Integer.parseInt(request.getParameter("Radio")),bds,bde);                          }catch(Exception ee){             ee.printStackTrace();          }%><tr>   <td>      <label>The apartment has been successfully booked</label>   </td><%       }              }   catch(Exception f){       f.printStackTrace();   }                 %><html>   <head>      <title>CAR Booking</title>   </head>   <body bgcolor="aqua" >   <h1 align="center">Car Renting</h1>   <p align="center">      <form method="POST" >         <table border="0">            <tr>               <td>                  <label>Start Date</label>               </td>               <td>                  <input type="text" name="sdate"/>               </td>               <td>                  <label>End Date</label>               </td>                <td>                  <input type="text" name="edate"/>               </td>               <td>                  <input type="submit" value="Find" name="OP"/>               </td>            </tr>         </table>         <table border="0">            <tr>               <td bgcolor="teal">                  <table border="0" >                     <tr>                        <th>Car ID</th>                        <th>Make</th>                        <th>Model</th>                        <th>Year of Fabr</th>                        <th>Price/Day</th>                        <th>Status</th>                     </tr><%       try {        if(request.getParameter("OP").equals("Find")){          String[] rand= new String [6];          List list= new ArrayList() ;          Utils ut=new Utils();          String ds=request.getParameter("sdate");          String de=request.getParameter("edate");          if(ut.verifyDate(ds)==0){%><SCRIPT LANGUAGE="JavaScript">   alert ("Wrong data format for start date verification! Look in the console"); </SCRIPT><%            }          if(ut.verifyDate(de)==0){%><SCRIPT LANGUAGE="JavaScript">   alert ("Wrong data format for end date verification! Look in the console"); </SCRIPT><%           }          ds=ut.convertDate(ds);          de=ut.convertDate(de);          list=bookBean.findAvailabeCars(ds,de);          Iterator  it= list.iterator();          while (it.hasNext()){             rand=(String[])it.next();                      %>                     <tr>                            <td><%= rand[0]%></td>                        <td><%= rand[1]%></td>                        <td><%= rand[2]%></td>                        <td><%= rand[3]%></td>                        <td><%= rand[4]%></td>                        <td>                           <input type="radio" name="Radio" value="<%= rand[0]%>">                         </td>                     </tr><%          }                                    }      }   catch(Exception q){}%>                                                            <tr>                        <td>                           <label>Booking Start Date</label>                        </td>                        <td>                           <input type="text" name="bsdate"/>                        </td>                        <td>                           <label>Booking End Date</label>                        </td>                         <td>                           <input type="text" name="bedate"/>                        </td>                         <td>                           <input type="submit" value="Book" name="OP"/>                        </td>                                           </tr>                                      </table>               </td>            </tr>         </table>       </form>      <a href="index.jsp">Logout</a>      </p>      <br/>   </body></html>   

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -