Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%--
- Document : List_Person
- Created on : 27-mag-2016, 9.15.54
- Author : Luigi
- --%>
- <%@page contentType="text/html" pageEncoding="UTF-8"%>
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>JSP Page</title>
- </head>
- <body>
- <%@ page import = "java.sql.*" %>
- <%
- String st1;
- String st2;
- String ritorno1;
- String ritorno2;
- Class.forName("oracle.jdbc.driver.OracleDriver");
- Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@Luigi-PC:1521:xe","esame","ciao");
- Statement stmt = conn.createStatement();
- String sql="select username,pass from accesso";
- ResultSet rs = stmt.executeQuery(sql);
- ritorno1=request.getParameter("message");
- ritorno2=request.getParameter("message2");
- try
- {
- if(rs!=null)
- {
- %>
- <%
- while(rs.next())
- {
- st1=rs.getString("username");
- st2=rs.getString("pass");
- int result_1 = st1.compareTo(ritorno1);
- int result_2 = st2.compareTo(ritorno2);
- if((result_1==0) && (result_2==0)){
- %>
- <jsp:include page="menu.jsp" />
- <%
- }else{
- %>
- <jsp:include page="index.jsp" />
- <%
- }
- }
- }
- }
- catch(SQLException e)
- {
- e.printStackTrace();
- }
- stmt.close();
- rs.close();
- conn.close();
- stmt=null;
- rs=null;
- conn=null;
- %>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement