急急急请帮助很郁闷
我在前台写了这么个程序
<form action="LoginServlet" method="post">
<table border="1" align ="center">
<tr>
<td>用户名</td>
<td> <input type="text" name="username"></td>
</tr>
<tr>
<td>密码</td>
<td> <input type ="password" name="userpass"></td>
</tr>
<tr>
<td> <input type ="submit" value="登录"> </td>
<td> <a href="Register.jsp"> 免费注册</a> </td>
</tr>
</table>
</form>
在后台写个这么个类在数据库里明明有三列username,userpass,和sex可为什么总是在结果集里显示只有两列呢请帮忙解答我老郁闷啦
package dljt;
import
java.io.IOException;
import java.io.PrintWriter;
import
javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author Administrator
*/
@WebServlet(name = "LoginServlet", urlPatterns = {"/LoginServlet"})
public class LoginServlet extends HttpServlet {
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws
ServletException,
IOException {
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
String username = request.getParameter("username");
String userpass = request.getParameter("userpass");
Connection conn = null;
Statement st = null;
ResultSet rs = null;
String Driver = "org.apache.derby.jdbc.ClientDriver";
String url = "jdbc:derby://localhost:1527/sample";
String user = "app";
String pass = "app";
String sql = "select username,userpass from QQ where username = '"+username+"'and userpass ='"+userpass+"'";
try {
Class.forName(Driver);
conn = DriverManager.getConnection(url, user, pass);
st = conn.createStatement();
rs = st.executeQuery(sql);
if(rs.next()) {
System.out.println(rs.getString(3))在这出的问题
out.println(rs.getString("USERNAME")+" "+rs.getString("USERPASS")+" ");
}else {
out.println("<script language = Javascript>");
out.println("window.alert(\"用户不存在请注册\")");