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

📄 index.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 4 - Message-based Distributed Systems   -    - File Name: index.jsp --%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><%@ page import="BusinessSessionBeans.*, java.math.*, javax.naming.*" %>   <%!   private UserSessionBeanRemote userB = null;   public String temp="";   public void jspInit() {      try {          InitialContext ic = new InitialContext();          userB = (UserSessionBeanRemote)          ic.lookup(UserSessionBeanRemote.class.getName());      } catch (Exception ex) {          System.out.println("Couldn't create converter bean."+          ex.getMessage());      }   }   public void jspDestroy() {      userB = null;   }%>   <html>   <head>      <title>Client Autentification</title>   </head>   <body bgcolor="#000055" >       <div align="center">           <font face="verdana" color="#FF8000">           <h1 align="center">Client Autentification</h1><br><br>         <form method="POST">            <p align="center">               <table bgcolor="#000055">                  <tr>                     <td>                        <p align="right">                           <label>username:</label>                         </p>                      </td>                      <td>                         <input type="text" name="name" />                      </td>                   </tr>                   <tr>                      <td>                         <p align="right">                            <label>email:</label>                         </p>                      </td>                      <td>                         <input type="text" name="email" />                      </td>                   </tr>                   <tr>                      <td>                         <p align="right">                            <label>password:</label>                         </p>                      </td>                      <td>                         <input type="password" name="code" />                      </td>                   </tr>                   <tr>                      <td>                      </td>                      <td>                                                     <input type="submit" name="OP"  value="Register"/> &nbsp;&nbsp;                            <input type="submit" name="OP"  value="Login"/>                      </td>                   </tr>                </table>             </p>          </form>          <br/><%       try {        temp="NOT LOGGED!";       if(request.getParameter("OP").equals("Login")){          String _fname = request.getParameter("name");          String _email=request.getParameter("email");           String _code=request.getParameter("code");           System.out.println("\n user:"+_fname+" mail:"+_email+" pass:"+_code);          int succ = 0;          int userid=0;          succ = userB.userLogin(_fname,_email,_code);          userid = userB.getUserId(_fname,_email,_code);          int type;          System.out.println("\n succ="+succ+" uid: "+userid);          if(succ==0){              temp="NOT LOGGED!";          }          else{             if(succ==9){                String redirectURL = "admin.jsp";                response.sendRedirect(redirectURL);              }             if(succ==2)             {                String redirectURL = "client.jsp?uid="+userid;                response.sendRedirect(redirectURL);              }          }       }       if(request.getParameter("OP").equals("Register")){          String redirectURL = "register.jsp";          response.sendRedirect(redirectURL);        }   }   catch(Exception ee){       ee.printStackTrace();   } %><%=temp%>    </font></div>   </body></html> 

⌨️ 快捷键说明

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