关于MYSql数据查询问题 - Java / Web 开发
就是想通过JavaBean连接MySQL
Java code:
package ch05;
import java.sql.Connection;
import java.sql.DriverManager;
public class DBConnection {
public static Connection getConnection(){
Connection conn = null;
String SERVANDDB = "jdbc:mysql://localhost:3306/xietanghui?user=root&password=admin&useUnicode=true&characterEncoding=8859_1";
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection(SERVANDDB);
}catch(Exception e){
e.printStackTrace();
}
return conn;
}
}
Java code:
package ch05;
public class AdminBean {
private String userName; //用户名
private String userPassword; //用户密码
public String getUserName(){
return this.userName;
}
public void setUserName(String userName){
this.userName = userName;
}
public String getPassword(){
return this.userPassword;
}
public void setUserPassword(String userPassword){
this.userPassword = userPassword;
}
}
HTML code
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.Cod
相关问答:
一个JSP页面接收其他页面提交过来的FORM表单,但是要求只接收当前站点及其子站点提交过来的FORM表单,其他站点提交过来的表单不接收,这个怎么设置?
用过滤器
filter
将当前站点及其子站点放一个目录
然 ......
代码如下 ,我想通过代理访问一些网址,但是不知道如何测试代理成功,我想通过访问“http://www.blogger.com/”来看看是否代理成功,但是也不能访问,出现异常“Unexpected end of file from server”,但是如果不这 ......
String sqlCount="select count(*) from usertable where username='"+
userName+"'";这句话 什么意思啊!
这句话输出出来就是
select count(*) from usertable where username='你的变量 ......
各位老大好。。。小弟有一个乱码问题急需帮忙解决
我在本页中用request.getParameter("name")取变量。。变量的赋值为汉字。我在页面的开头加了<%@ page language = "java" contentType=&quo ......