資源簡介
本示例是使用JavaWeb技術(shù)實現(xiàn)一個簡單的圖片管理與分享系統(tǒng),其中主要功能如下:
用戶分類瀏覽系統(tǒng)中的圖片縮略圖
用戶查看單張圖片的詳細(xì)信息,圖片下載
用戶查看一個分類內(nèi)的所有圖片縮略圖
用戶使用關(guān)鍵字進(jìn)行模糊搜索
管理員登錄
管理員擁有普通用戶的所有功能,同時能夠?qū)崿F(xiàn)圖片的刪除
使用的主要技術(shù)有:
JavaEE、JSP、Struts2、Hibernate、JavaBean
本項目開發(fā)環(huán)境為:
Intellij IDEA 2016.3
Tomcat 8
JDK 1.8
MySQL 5.5
代碼片段和文件信息
package?cn.hncu.Action;
import?cn.hncu.Dao.AdminEntity;
import?org.apache.struts2.ServletActionContext;
import?org.hibernate.Session;
import?org.hibernate.SessionFactory;
import?org.hibernate.cfg.Configuration;
import?javax.servlet.http.HttpServletRequest;
import?javax.servlet.http.HttpServletResponse;
import?javax.servlet.http.HttpSession;
/**
?*?Created?by?32706?on?2017/4/20.
?*/
public?class?CheckLoginAction?{
????private?String?admin;
????private?String?password;
????public?String?getAdmin()?{
????????return?admin;
????}
????public?void?setAdmin(String?admin)?{
????????this.admin?=?admin;
????}
????public?String?getPassword()?{
????????return?password;
????}
????public?void?setPassword(String?password)?{
????????this.password?=?password;
????}
????public??String?check()
????{
????????HttpServletResponse?response?=?ServletActionContext.getResponse();
????????response.setContentType(“text/plain“);
????????response.setCharacterEncoding(“utf-8“);
????????HttpServletRequest?request=ServletActionContext.getRequest();
????????HttpSession?session=request.getSession();
????????System.out.println(this.admin);
????????String?realPassword=getPasswordByAccount(this.admin);
????????if(realPassword!=null&&realPassword.equals(password))
????????{
????????????session.setAttribute(“username“admin);
????????????return?“successful“;
????????}
????????else
????????{
????????????return?“failed“;
????????}
????}
????private?String?getPasswordByAccount(String?admin)
????{
????????String?rt=null;
????????Configuration?configuration=new?Configuration().configure();
????????SessionFactory?sessionFactory=configuration.buildSessionFactory();
????????Session?session=sessionFactory.openSession();
????????AdminEntity?tem=(AdminEntity)session.get(AdminEntity.classadmin)?;
???????if(tem!=null)
????????{
????????????return??tem.getPassword();
????????}
????????return?rt;
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-05-21?18:55??MyPhotoWeb\
?????目錄???????????0??2017-05-21?18:54??MyPhotoWeb\JavaWeb-Picture-Management-System\
?????目錄???????????0??2017-04-23?00:50??MyPhotoWeb\JavaWeb-Picture-Management-System\.git\
?????文件?????????395??2014-12-19?12:57??MyPhotoWeb\JavaWeb-Picture-Management-System\.gitattributes
?????文件?????????862??2017-04-23?00:29??MyPhotoWeb\JavaWeb-Picture-Management-System\.gitignore
?????文件??????????16??2017-04-23?00:30??MyPhotoWeb\JavaWeb-Picture-Management-System\.git\COMMIT_EDITMSG
?????文件?????????334??2017-04-23?00:34??MyPhotoWeb\JavaWeb-Picture-Management-System\.git\config
?????文件??????????73??2017-04-23?00:29??MyPhotoWeb\JavaWeb-Picture-Management-System\.git\desc
?????文件?????????129??2017-04-23?00:34??MyPhotoWeb\JavaWeb-Picture-Management-System\.git\FETCH_HEAD
?????文件??????????23??2017-04-23?00:29??MyPhotoWeb\JavaWeb-Picture-Management-System\.git\HEAD
?????目錄???????????0??2017-04-23?00:29??MyPhotoWeb\JavaWeb-Picture-Management-System\.git\hooks\
?????文件?????????177??2017-04-23?00:29??MyPhotoWeb\JavaWeb-Picture-Management-System\.git\hooks\README.sample
?????文件???????19632??2017-04-23?00:30??MyPhotoWeb\JavaWeb-Picture-Management-System\.git\index
?????目錄???????????0??2017-04-23?00:29??MyPhotoWeb\JavaWeb-Picture-Management-System\.git\info\
?????文件?????????113??2017-04-23?00:29??MyPhotoWeb\JavaWeb-Picture-Management-System\.git\info\exclude
?????目錄???????????0??2017-04-23?00:29??MyPhotoWeb\JavaWeb-Picture-Management-System\.git\logs\
?????文件?????????362??2017-04-23?00:30??MyPhotoWeb\JavaWeb-Picture-Management-System\.git\logs\HEAD
?????目錄???????????0??2017-04-23?00:34??MyPhotoWeb\JavaWeb-Picture-Management-System\.git\logs\refs\
?????目錄???????????0??2017-04-23?00:29??MyPhotoWeb\JavaWeb-Picture-Management-System\.git\logs\refs\heads\
?????文件?????????362??2017-04-23?00:30??MyPhotoWeb\JavaWeb-Picture-Management-System\.git\logs\refs\heads\master
?????目錄???????????0??2017-04-23?00:34??MyPhotoWeb\JavaWeb-Picture-Management-System\.git\logs\refs\remotes\
?????目錄???????????0??2017-04-23?00:34??MyPhotoWeb\JavaWeb-Picture-Management-System\.git\logs\refs\remotes\origin\
?????文件?????????148??2017-04-23?00:34??MyPhotoWeb\JavaWeb-Picture-Management-System\.git\logs\refs\remotes\origin\master
?????目錄???????????0??2017-04-23?00:30??MyPhotoWeb\JavaWeb-Picture-Management-System\.git\ob
?????目錄???????????0??2017-04-23?00:30??MyPhotoWeb\JavaWeb-Picture-Management-System\.git\ob
?????文件????????3566??2017-04-23?00:30??MyPhotoWeb\JavaWeb-Picture-Management-System\.git\ob
?????文件????????5779??2017-04-23?00:30??MyPhotoWeb\JavaWeb-Picture-Management-System\.git\ob
?????目錄???????????0??2017-04-23?00:30??MyPhotoWeb\JavaWeb-Picture-Management-System\.git\ob
?????文件????????5605??2017-04-23?00:30??MyPhotoWeb\JavaWeb-Picture-Management-System\.git\ob
?????目錄???????????0??2017-04-23?00:30??MyPhotoWeb\JavaWeb-Picture-Management-System\.git\ob
?????文件????????2747??2017-04-23?00:30??MyPhotoWeb\JavaWeb-Picture-Management-System\.git\ob
............此處省略378個文件信息
- 上一篇:java SSH 超市后臺管理系統(tǒng)
- 下一篇:android掃雷demo
評論
共有 條評論