<body>
<%@page import="java.sql.*" %>
<%@page import="javax.sql.*" %>
<%
String user=request.getParameter("username");
session.putValue("uname",user);
String pass=request.getParameter("pass");
Class.forName("com.mysql.jdbc.Driver");
java.sql.Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/javaproject","root","");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select * from university where username='"+user+"'");
if(rs.next())
{
if(rs.getString(3).equals(pass))
{
response.sendRedirect("Uuserprofile.jsp?id=<%=rs.getString("id")%>");
}
netbeans ide说')'未封闭的字符串文字,但我不明白它的遗失
改变这个:
response.sendRedirect("Uuserprofile.jsp?id=<%=rs.getString("id")%>");
对此:
response.sendRedirect("Uuserprofile.jsp?id="<%=rs.getString("id")%>);