📄 midletuserdataservlet.java
字号:
import java.sql.*;
import javax.sql.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import db.* ;
public class MIDletUserDataServlet extends HttpServlet
{
protected void doGet(HttpServletRequest request,HttpServletResponse response)
throws IOException, ServletException
{
response.setContentType("text/plain;charset=UTF-8");
DataOutputStream dos = new DataOutputStream(response.getOutputStream());
Connection conn = null ;
ResultSet rs = null ;
Statement stmt = null ;
try
{
AccessDAO da = new AccessDAO("enterprisedata") ;
conn = da.getConnection() ;
stmt = conn.createStatement() ;
String command = "select * from user" ;
rs = stmt.executeQuery(command) ;
while(rs.next())
{
StringBuffer s = new StringBuffer("") ;
s.append(rs.getString("id")) ;
s.append(",") ;
s.append(rs.getString("password")) ;
s.append(",") ;
s.append(rs.getString("description")) ;
s.append(";") ;
dos.writeUTF(s.toString()) ;
dos.flush() ;
}
dos.close() ;
rs.close() ;
stmt.close() ;
conn.close() ;
}catch(Exception e)
{
}
}
}
//取得参数的方式
//String xxx = request.getParameter("xxx");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -