package StudyBbs;
import java.util.*;
import java.sql.Connection;
import java.sql.ResultSet;
public class User {
private String username = null;
private String password = null;
private String nickname = null;
private String sex = null;
private String birthyear = null;
private String birthmonth = null;
private String birthday = null;
private String email = null;
private String mobile = null;
private String signiture = null;
private String grade = null;
private int score = 0;
public User(){}
public void setUsername(String username) {
this.username = username;
}
public String getUsername() {
return username;
}
public void setPassword(String password) {
this.password = password;
}
public String getPassword() {
return password;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getNickname() {
return nickname;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getSex() {
return sex;
}
public void setBirthyear(String birthyear) {
this.birthyear = birthyear;
}
public String getBirthyear() {
return birthyear;
}
public void setBirthmonth(String birthmonth) {
this.birthmonth = birthmonth;
}
public String getBirthmonth() {
return birthmonth;
}
public void setBirthday(String birthday) {
this.birthday = birthday;
}
public String getBirthday() {
return birthday;
}
public void setEmail(String email) {
this.email = email;
}
public String getEmail() {
return email;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getMobile() {
return mobile;
}
public void setSigniture(String signiture) {
this.signiture = signiture;
}
public String getSigniture() {
return signiture;
}
public void setGrade(String grade) {
this.grade = grade;
}
public String getGrade() {
return grade;
}
public void setScore(int score) {
this.score = score;
}
public int getScore() {
return score;
}
public static boolean checkUser(DB db,String name,String psw) throws Exception{
String strSql;
ResultSet rs;
strSql = "select * from bbsuser where username='"
+ name + "' and password='" + psw + "'";
rs = db.OpenSql(strSql);
if ( rs.next()) {
return true;
}
else{
return false;
}
}
public boolean Insert(DB db) throws Exception{
String strSql;
strSql = "insert into bbsuser values('"
+ username +"','"
+ password +"','"
+ nickname +"','"
+ sex +"','"
+ birthyear +"','"
+ birthmonth+"','"
+ birthday +"','"
+ email +"','"
+ mobile +"','"
+ signiture +"','普通用户',10)";
if ( db.ExecSql(strSql)==0) {
return false;
}
else{
return true;
}
}
public static String getUserGrade(DB db,String name) throws Exception{
String strSql;
ResultSet rs;
strSql = "select * from bbsuser where username='"
+ name + "'";
rs = db.OpenSql(strSql);
if ( rs.next()) {
return rs.getString("usergrade");
}
else{
return null;
}
}
public static Vector Search(DB db ,String username) throws Exception{
Vector Users = new Vector();
ResultSet rs,rsNest;
String strSql=null;
strSql = "select * from bbsuser where username like '%" + username + "%'";
rs = db.OpenSql(strSql);
while (rs.next()){
User user = new User();
user.setUsername(rs.getString("username")) ;
user.setGrade(rs.getString("usergrade")) ;
Users.add(user);
}
return Users;
}
public static Vector SearchMaster(DB db) throws Exception{
Vector Users = new Vector();
ResultSet rs,rsNest;
String strSql=null;
strSql = "select * from bbsuser where usergrade = '斑竹'";
rs = db.OpenSql(strSql);
while (rs.next()){
User user = new User();
user.setUsername(rs.getString("username")) ;
user.setGrade(rs.getString("usergrade")) ;
Users.add(user);
}
return Users;
}
public static boolean Delete(DB db,String username) throws Exception{
String strSql;
strSql = "delete from bbsuser where username='"+username+"'";
if ( db.ExecSql(strSql)==0) {
return false;
}
else{
return true;
}
}
public static boolean Edit(DB db,String username,String grade,String sort) throws Exception{
String strSql;
strSql = "update bbsuser set usergrade='"+grade+"' where username='"+username+"'";
if ( db.ExecSql(strSql)==0) {
return false;
}
else{
if (!grade.equals("斑竹")){
strSql = "update sort set master='' where master='"+username+"'";
db.ExecSql(strSql);
}
return true;
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
struts+jsp+access实现bbs
共261个文件
gif:96个
class:64个
java:32个
需积分: 3 17 下载量 148 浏览量
2008-12-18
11:33:28
上传
评论
收藏 1.57MB RAR 举报
温馨提示
通过struts+jsp+access实现的bbs。
资源推荐
资源详情
资源评论
收起资源包目录
struts+jsp+access实现bbs (261个子文件)
User.class 6KB
User.class 4KB
NewTopicSubmitAction.class 4KB
Respond.class 4KB
Sort.class 4KB
Respond.class 3KB
SignAction.class 3KB
TopicAction.class 3KB
ActionUserEdit.class 3KB
NewTopicSubmitAction.class 3KB
ActionSortInsert.class 3KB
Topic.class 3KB
ActionSortEditSubmit.class 3KB
LoginAction.class 3KB
ActionTopicDel.class 3KB
ActionAdminLogin.class 3KB
Sort.class 3KB
ActionSortDel.class 3KB
ActionUserDel.class 3KB
ActionUserAdmin.class 3KB
ActionSortAdmin.class 3KB
UserForm.class 3KB
TopicDisp.class 3KB
TopicAction.class 2KB
SignAction.class 2KB
Topic.class 2KB
ActionSortInsert.class 2KB
ActionUserEdit.class 2KB
ActionSortEdit.class 2KB
LoginAction.class 2KB
ActionSortEditSubmit.class 2KB
ActionTopicSearch.class 2KB
ContentAction.class 2KB
ActionUserSearch.class 2KB
TopicDisp.class 2KB
ActionTopicDel.class 2KB
ActionAdminLogin.class 2KB
NewTopicAction.class 2KB
ActionUserDel.class 2KB
ActionSortDel.class 2KB
UserForm.class 2KB
ActionUserAdmin.class 2KB
ActionSortAdmin.class 2KB
ActionSortEdit.class 2KB
NewTopicAction.class 2KB
ActionTopicSearch.class 2KB
DB.class 2KB
ContentAction.class 2KB
ActionUserSearch.class 2KB
DB.class 1KB
ActionSortPreInsert.class 1KB
PreSignAction.class 1KB
Constants.class 1KB
Constants.class 1011B
SortForm.class 972B
MyRequestProcessor.class 961B
LoginUserForm.class 779B
SortForm.class 766B
ActionSortPreInsert.class 765B
PreSignAction.class 749B
MyRequestProcessor.class 707B
LoginUserForm.class 614B
TopicForm.class 510B
TopicForm.class 395B
.classpath 1KB
style.css 2KB
style.css 2KB
btn_28.gif 1KB
btn_28.gif 1KB
btn_30.gif 1KB
btn_30.gif 1KB
btn_32.gif 1KB
btn_32.gif 1KB
bg_01.gif 1KB
bg_01.gif 1KB
b012.gif 942B
b012.gif 942B
btn_10.gif 882B
btn_10.gif 882B
btn_07.gif 843B
btn_07.gif 843B
b022.gif 799B
b022.gif 799B
btn_18.gif 722B
btn_18.gif 722B
btn_24.gif 642B
btn_24.gif 642B
icon_15.gif 601B
icon_15.gif 601B
btn_01.gif 560B
btn_01.gif 560B
btn_05.gif 545B
btn_05.gif 545B
btn_09.gif 533B
btn_02.gif 533B
btn_09.gif 533B
btn_02.gif 533B
btn_08.gif 523B
btn_08.gif 523B
part1_38.gif 522B
共 261 条
- 1
- 2
- 3
资源评论
whq2004
- 粉丝: 3
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功