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

📄 client2_jsp.java

📁 Java Application using EJB 3.0 for renting a car - Entities : Car, User, Renting Business Logic. Ne
💻 JAVA
字号:
package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import BusinessSessionBeans.*;
import Entities.*;
import java.math.*;
import java.text.*;
import java.util.*;
import javax.naming.*;
import java.util.StringTokenizer;

public final class client2_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

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;}
  private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();

  private static java.util.Vector _jspx_dependants;

  private org.apache.jasper.runtime.ResourceInjector _jspx_resourceInjector;

  public Object getDependants() {
    return _jspx_dependants;
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      response.setContentType("text/html;charset=UTF-8");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;
      _jspx_resourceInjector = (org.apache.jasper.runtime.ResourceInjector) application.getAttribute("com.sun.appserv.jsp.resource.injector");

      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\n");
      out.write("   \"http://www.w3.org/TR/html4/loose.dtd\">\n");
      out.write("   \n");
      out.write(" \n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
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);     
      out.write("\n");
      out.write("\n");
      out.write("<html>\n");
      out.write("    <head>\n");
      out.write("        <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n");
      out.write("<title>User Authentication</title>\n");
      out.write("<style type=\"text/css\">\n");
      out.write("<!--\n");
      out.write(".style1 {\n");
      out.write("\tfont-family: Arial, Helvetica, sans-serif;\n");
      out.write("\tfont-size: 24px;\n");
      out.write("\tcolor: #FF0000;\n");
      out.write("}\n");
      out.write(".style4 {font-size: 18px}\n");
      out.write(".style6 {font-size: 18px; color: #000000; }\n");
      out.write("-->\n");
      out.write("</style>\n");
      out.write("</head>\n");
      out.write("\n");
      out.write("<body>\n");
      out.write("<form id=\"form1\" name=\"form1\" method=\"post\" onSubmit=\"return OnSubmitForm();\">\n");
      out.write("  <div align=\"center\" class=\"style1\">\n");
      out.write("    <p>&nbsp; </p>\n");
      out.write("    <p align=\"center\">Car Booking </p>\n");
      out.write("    <p>&nbsp;</p>\n");
      out.write("     <table width=\"816\" border=\"0\" align=\"center\">\n");
      out.write("    <tr>\n");
      out.write("        <td width=\"308\"><label><span class=\"style6\">Start Date</span>\n");
      out.write("            <input type=\"text\" name=\"tStartDate\" value=\"\"/>\n");
      out.write("        </label></td>\n");
      out.write("        <td width=\"342\"><label><span class=\"style6\">EndDate</span>\n");
      out.write("            <input type=\"text\" name=\"tEndDate\" value=\"\"/>\n");
      out.write("        </label></td>\n");
      out.write("        <td width=\"152\"><label>\n");
      out.write("          \n");
      out.write("        </label></td>\n");
      out.write("      </tr>\n");
      out.write("     \n");
      out.write("       \n");
      out.write("       </table>\n");
      out.write("            <div align=\"center\"><span class=\"style6\"></span>\n");
      out.write("          <input type=\"submit\" name=\"Find available cars\" onClick=\"document.pressed=this.value\" value=\"Find\" />\n");
      out.write("        </div>\n");
      out.write(" \n");
      out.write("   \n");
      out.write("    <p class=\"style4\">&nbsp;</p>\n");
      out.write("     <table width=\"515\" border=\"1\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">\n");
      out.write("         \n");
      out.write("    <tr>\n");
      out.write("      <th width=\"87\" class=\"style6\" scope=\"col\">Id&nbsp;</th>\n");
      out.write("      <th width=\"81\" class=\"style3\" scope=\"col\"><span class=\"style6\">Make</span>&nbsp;</th>\n");
      out.write("      <th width=\"64\" class=\"style3\" scope=\"col\"><span class=\"style6\">Model</span>&nbsp;</th>\n");
      out.write("      <th width=\"91\" class=\"style6\" scope=\"col\">Year</th>\n");
      out.write("      <th width=\"180\" class=\"style6\" scope=\"col\">PricePerDay</th>\n");
      out.write("      \n");
      out.write("    </tr>\n");
      out.write("    ");
 if (!cars.equals(null))for (int i = 0; i < cars.size(); i++) { CarEntityBean car=new CarEntityBean();    car=(CarEntityBean)cars.get(i);  
      out.write("\n");
      out.write("    <tr>\n");
      out.write("        \n");
      out.write("      <td class=\"style3\">");
      out.print(car.getId());
      out.write("&nbsp;</td>\n");
      out.write("      <td class=\"style3\">");
      out.print(car.getMake());
      out.write("&nbsp;</td>\n");
      out.write("      <td class=\"style3\">");
      out.print(car.getModel());
      out.write("&nbsp;</td>\n");
      out.write("      <td class=\"style3\">");
      out.print(car.getYearOfFabr());
      out.write("&nbsp;</td>\n");
      out.write("      <td class=\"style3\">");
      out.print(car.getPrice());
      out.write("&nbsp;</td>\n");
      out.write("     \n");
      out.write("    </tr>\n");
      out.write("\t");
}
      out.write("\n");
      out.write("  </table>\n");
      out.write("    <p>&nbsp;</p>\n");
      out.write("   \n");
      out.write("    \n");
      out.write("        <table width=\"816\" border=\"0\" align=\"center\">\n");
      out.write("      <tr>\n");
      out.write("        <td width=\"308\"><label><span class=\"style6\">Id user</span>\n");
      out.write("            <input type=\"text\" name=\"tIdUser\" value=");
      out.print(idUserului);
      out.write(" disabled=\"disabled\"/>\n");
      out.write("        </label></td>\n");
      out.write("        <td width=\"342\"><label><span class=\"style6\">Id car</span>\n");
      out.write("            <input type=\"text\" name=\"tIdCar\" />\n");
      out.write("        </label></td>\n");
      out.write("        <td width=\"152\"><label>\n");
      out.write("          \n");
      out.write("        </label></td>\n");
      out.write("      </tr>\n");
      out.write("\t  \n");
      out.write("\t   \n");
      out.write("    </table>\n");
      out.write("      \n");
      out.write("        <div align=\"center\"><span class=\"style6\"></span>\n");
      out.write("          <input type=\"submit\" name=\"Book\" onClick=\"document.pressed=this.value\" value=\"Book\" />\n");
      out.write("        </div>\n");
      out.write("       \n");
      out.write("        <p>&nbsp;</p>\n");
      out.write("        \n");
      out.write("\t\t \n");
      out.write("\t\t   <div align=\"left\">\n");
      out.write("\t\t     <input type=\"submit\" name=\"Logout\" onClick=\"document.pressed=this.value\" value=\"Logout\" />\n");
      out.write("\t\t     \n");
      out.write("    </div></div>\n");
      out.write("</form>\n");
      out.write("</body>\n");
      out.write("</html>\n");
      out.write("<SCRIPT language=\"JavaScript\">\n");
      out.write("function OnSubmitForm()\n");
      out.write("{  \n");
      out.write("  if(document.pressed == 'Book')\n");
      out.write("  {\n");
      out.write("   \n");
      out.write("   document.form1.action =\"client.jsp\";\n");
      out.write("  }\n");
      out.write("  else\n");
      out.write("  if(document.pressed == 'Logout')\n");
      out.write("  {\n");
      out.write("    document.form1.action =\"index.jsp\";\n");
      out.write("  }\n");
      out.write("  else\n");
      out.write("  if(document.pressed == 'Find')\n");
      out.write("  {\n");
      out.write("    document.form1.action =\"client.jsp\";\n");
      out.write("  }\n");
      out.write("  return true;\n");
      out.write("}\n");
      out.write("</SCRIPT>");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          out.clearBuffer();
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}

⌨️ 快捷键说明

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