login_jsp.java
来自「手机在线系统 采用Java 中的J2ME, JSP 跟MySql 运行环」· Java 代码 · 共 172 行
JAVA
172 行
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;
import com.j2me.databases.*;
public final class login_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static java.util.Vector _jspx_dependants;
public java.util.List getDependants() {
return _jspx_dependants;
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
JspFactory _jspxFactory = null;
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html; charset=gb2312");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("<HTML>\r\n");
out.write("\r\n");
out.write("<HEAD>\r\n");
out.write("\r\n");
out.write("<TITLE> New Document </TITLE>\r\n");
out.write("\r\n");
out.write("</HEAD>\r\n");
out.write("\r\n");
out.write("<BODY>\r\n");
User u = null;
try
{
u = new User();
u.connect();
}
catch(ClassNotFoundException e)
{
out.println(e.getMessage());
}
try
{
String user = null;
String password = null ;
ResultSet rs = u.viewUser("select *from user;");
while (rs.next())
{
//id=rs.getString(1);
user =rs.getString(1);
byte[] tmpbyte=user.getBytes("8859_1");
user = new String(tmpbyte);
password=rs.getString(2);
out.println( " "+ user + " " + password);
}
}
catch(SQLException sqlexception)
{
out.println(sqlexception.getMessage());
}
/*Statement stmt = null;
ResultSet rs = null;
Connection con=null;
String driver="org.gjt.mm.mysql.Driver";
String url="jdbc:mysql://localhost/wuhua?user=root&password=123&useUnicode=true&characterEncoding=ISO8859_1";
try
{ //DataBaseConnection daf = new DataBaseConnection();
Class.forName(driver);
con = DriverManager.getConnection(url);
out.println("Connection is established.");
}
catch(ClassNotFoundException e)
{
out.println("Driver can not be found.");
}
catch(SQLException sqlexception)
{
out.println("Connection can not be established.");
out.println(sqlexception.getMessage());
}
try
{
String sql = "SELECT *FROM user"; //"Insert Into user(name, password) values('饶荣庆', 'rrq123')";
stmt = con.createStatement();
rs = stmt.executeQuery(sql);
// String id = null ;
String user = null;
String password = null ;
while (rs.next())
{
//id=rs.getString(1);
user =rs.getString(1);
byte[] tmpbyte=user.getBytes("8859_1");
user = new String(tmpbyte);
password=rs.getString(2);
out.println( " "+ user + " " + password);
}
}
catch (SQLException e)
{
out.println("SQL Exception.");
} */
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("</BODY>\r\n");
out.write("</HTML>\r\n");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
}
} finally {
if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?