Ich möchte ein JSP namens home.jsp umleiten, um jsp.Weit zu begrüßen. Es funktioniert nicht. Bitte sagen Sie mir, wo soll ich wrong.There sind drei einfache jsp below.Please helfen mir denken out.I gibt es einige Fehler in Verbindung mit der DatenbankIch möchte ein JSP mit dem Namen home.jsp umleiten, um jsp willkommen zu heißen. Es funktioniert nicht. Bitte sagen Sie mir, wo ich falsch liege
home.jsp-
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
\t pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Welcome</title>
</head>
<body>
<form action='login.jsp' method="post">
\t <div>
\t \t <table>
\t \t \t <tr>
\t \t \t \t <td>USERNAME</td>
\t \t \t \t <td><input type="text" id="usernameID"/></td>
\t \t \t </tr>
\t \t \t <tr>
\t \t \t \t <td>PASSWORD</td>
\t \t \t \t <td><input type="text" id=passwordID /></td>
\t \t \t </tr>
\t \t \t <tr>
\t \t \t \t <td></td>
\t \t \t \t <td><input type="button" id="loginId" value="LOGIN" /></td>
\t \t \t </tr>
\t \t </table>
\t </div>
</form>
</body>
</html>
login.jsp-
<%@ page import="java.sql.*" %>
<%Class.forName("oracle.jdbc.driver.OracleDriver"); %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:8081:XE", "SYSTEM", "Lalita");
PreparedStatement ps=(PreparedStatement)con.createStatement();
String id=request.getParameter("usernameID");
String password=request.getParameter("passwordID");
ResultSet rs=ps.executeQuery("select * from USERCREDENTIALS");
String rsID=rs.getString(1);
String rsPassword=rs.getString(2);
out.println(rsID);
if(id==rsID && password==rsPassword)
\t response.sendRedirect("./welcome.jsp");
%>
</body>
</html>
welcome.jsp-
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
hiiiiiiiiiiiiiiiiiiiiiiii
</body>
</html>
Es hat immer noch nicht funktioniert .... bitte jemand Guide.Ich möchte wirklich wissen, wo ich falsch liege. – Lalita
Ich bin ein wenig verwirrt, dass nach dem Klicken auf Login-Taste, wie es zu login.jsp gehen würde, wird nur von Form Aktion umgeleitet werden ??? – Lalita
ho Ich habe es, Sie müssen den Eingangstyp von ** type = "button" ** zu diesem ** type = "submit" ** ändern. –