資源簡介
javaweb開發的簡單的新聞管理系統,采用myeclispe10.0,mysql,有基本的新聞發布,增刪改查以及用戶評論的功能,前端界面寫的比較簡單,但對初學者肯定有一定幫助的,10分絕對物有所值!歡迎交流,也可以加我 和我一起探討

代碼片段和文件信息
package?com.bean;
import?java.sql.PreparedStatement;
import?java.sql.ResultSet;
import?java.sql.SQLException;
import?com.dbService.LoginService;
public?class?User?{
private?String?username;
private?String?password;
private?String?tel;
public?String?getUsername()?{
return?username;
}
public?void?setUsername(String?username)?{
this.username?=?username;
}
public?String?getPassword()?{
return?password;
}
public?void?setPassword(String?password)?{
this.password?=?password;
}
public?String?getTel()?{
return?tel;
}
public?void?setTel(String?tel)?{
this.tel?=?tel;
}
public?int?Login(User?user)?throws?SQLException?{
String?sql?=?“select?password?from?user?where?username=?“;
ResultSet?rs?=?null;
PreparedStatement?ps?=?LoginService.executePreparedStatement(sql);
ps.setString(1?user.getUsername());
rs?=?ps.executeQuery();
while?(rs.next())?{
int?count?=?rs.getRow();
if?(count?>?0)?{
if?(rs.getString(“password“).equals(user.getPassword()))?{
return?1;
}?else?{
return?-1;
}
}?else?{
return?-2;
}
}
return?-3;
}
public?boolean?Regist(User?user)?throws?SQLException?{
String?sql1?=?“select?password?from?user?where?username=?“;
ResultSet?rs?=?null;
PreparedStatement?ps1?=?LoginService.executePreparedStatement(sql1);
ps1.setString(1?user.getUsername());
rs?=?ps1.executeQuery();
if?(rs.next()?==?true)?{
return?false;
}?else?{
String?sql?=?“insert?into?user(usernamepassword)values(??)“;
PreparedStatement?ps?=?LoginService.executePreparedStatement(sql);
int?result?=?0;
try?{
ps.setString(1?user.getUsername());
ps.setString(2?user.getPassword());
result?=?ps.executeUpdate();
}?catch?(SQLException?e)?{
//?TODO?Auto-generated?catch?block
e.printStackTrace();
}
if?(result?>?0)?{
return?true;
}?else?{
return?false;
}
}
}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-06-10?15:32??基于javaweb的簡單新聞管理系統\
?????目錄???????????0??2017-06-10?15:32??基于javaweb的簡單新聞管理系統\WebNews\
?????文件???????10137??2017-06-09?22:34??基于javaweb的簡單新聞管理系統\webnews.sql
?????文件?????????622??2017-06-09?16:10??基于javaweb的簡單新聞管理系統\WebNews\.classpath
?????目錄???????????0??2017-06-09?16:09??基于javaweb的簡單新聞管理系統\WebNews\.myeclipse\
?????文件?????????294??2017-06-09?16:09??基于javaweb的簡單新聞管理系統\WebNews\.myme
?????文件????????1750??2017-06-09?16:16??基于javaweb的簡單新聞管理系統\WebNews\.project
?????目錄???????????0??2017-06-10?15:32??基于javaweb的簡單新聞管理系統\WebNews\.settings\
?????文件?????????500??2017-06-09?16:09??基于javaweb的簡單新聞管理系統\WebNews\.settings\.jsdtscope
?????文件?????????395??2017-06-09?16:09??基于javaweb的簡單新聞管理系統\WebNews\.settings\org.eclipse.jdt.core.prefs
?????文件?????????459??2017-06-09?16:09??基于javaweb的簡單新聞管理系統\WebNews\.settings\org.eclipse.wst.common.component
?????文件?????????252??2017-06-09?16:09??基于javaweb的簡單新聞管理系統\WebNews\.settings\org.eclipse.wst.common.project.facet.core.xm
?????文件??????????49??2017-06-09?16:09??基于javaweb的簡單新聞管理系統\WebNews\.settings\org.eclipse.wst.jsdt.ui.superType.container
?????文件???????????6??2017-06-09?16:09??基于javaweb的簡單新聞管理系統\WebNews\.settings\org.eclipse.wst.jsdt.ui.superType.name
?????目錄???????????0??2017-06-10?15:32??基于javaweb的簡單新聞管理系統\WebNews\src\
?????目錄???????????0??2017-06-10?15:32??基于javaweb的簡單新聞管理系統\WebNews\src\com\
?????目錄???????????0??2017-06-10?15:32??基于javaweb的簡單新聞管理系統\WebNews\src\com\bean\
?????文件????????1997??2017-06-09?20:35??基于javaweb的簡單新聞管理系統\WebNews\src\com\bean\User.java
?????目錄???????????0??2017-06-10?15:32??基于javaweb的簡單新聞管理系統\WebNews\src\com\dbService\
?????文件????????2275??2017-06-09?17:40??基于javaweb的簡單新聞管理系統\WebNews\src\com\dbService\LoginService.java
?????目錄???????????0??2017-06-10?15:32??基于javaweb的簡單新聞管理系統\WebNews\src\com\servlet\
?????文件????????3547??2017-06-09?19:52??基于javaweb的簡單新聞管理系統\WebNews\src\com\servlet\Login.java
?????文件????????3189??2017-06-09?20:38??基于javaweb的簡單新聞管理系統\WebNews\src\com\servlet\Register.java
?????目錄???????????0??2017-06-10?15:32??基于javaweb的簡單新聞管理系統\WebNews\WebRoot\
?????文件????????1604??2017-06-09?21:04??基于javaweb的簡單新聞管理系統\WebNews\WebRoot\add.jsp
?????文件????????2120??2017-06-09?21:12??基于javaweb的簡單新聞管理系統\WebNews\WebRoot\addnews.jsp
?????目錄???????????0??2017-06-10?15:32??基于javaweb的簡單新聞管理系統\WebNews\WebRoot\admin\
?????目錄???????????0??2017-06-10?15:32??基于javaweb的簡單新聞管理系統\WebNews\WebRoot\admin\image\
?????目錄???????????0??2017-06-10?15:32??基于javaweb的簡單新聞管理系統\WebNews\WebRoot\admin\images\
?????文件????????1804??2017-06-09?20:40??基于javaweb的簡單新聞管理系統\WebNews\WebRoot\admin\images\1.gif
?????文件????????1736??2017-06-09?20:40??基于javaweb的簡單新聞管理系統\WebNews\WebRoot\admin\images\2.gif
............此處省略42個文件信息
- 上一篇:JSP網頁連接數據庫增刪改查模板
- 下一篇:java簡單的購物車系統
評論
共有 條評論