資源簡介
JSP + Servlet 實現 網絡相冊 源代碼
新建相冊 刪除相冊 上傳照片 瀏覽照片等功能。類似 QQ空間相冊功能。

代碼片段和文件信息
package?com.handson.dao;
import?java.sql.Connection;
import?java.sql.PreparedStatement;
import?java.sql.ResultSet;
import?java.sql.SQLException;
import?java.sql.Statement;
import?java.util.ArrayList;
import?java.util.List;
import?com.handson.model.connection.ConnectionFactory;
import?com.handson.model.vo.Album;
import?com.handson.model.vo.AlbumPhoto;
public?class?AlbumDao?{
?public?List?queryAllAlbum(Album?album)?{
????List?albumlist?=?new?ArrayList();
????Statement?st=?null;
ResultSet?rs?=?null;
Connection?con?=?ConnectionFactory.getConnection();
try?{
st?=?con.createStatement();
rs?=?st.executeQuery(“select?*?from?t_album?where?user_id=“+album.getUser_id());
while(rs.next()){
Album?alBum?=?new?Album();
alBum.setAlbum_id(rs.getInt(“album_id“));
alBum.setAlbum_name(rs.getString(“album_name“));
alBum.setAlbum_content(rs.getString(“album_content“));
alBum.setAlbum_picurl(rs.getString(“album_picurl“));
albumlist.add(alBum);
}
}?catch?(SQLException?e)?{
e.printStackTrace();
}
return?albumlist;
}
?
? public?List?getPhoto(String?albumid){
? int?id?=?Integer.parseInt(albumid);
? List?list?=?new?ArrayList();
? Statement?st=?null;
? ResultSet?rs?=?null;
?
? Connection?con?=?ConnectionFactory.getConnection();
? try?{
? st?=?con.createStatement();
? rs?=?st.executeQuery(“select?*?from?t_albumphoto?where?album_id=“+id);
? while(rs.next()){
? AlbumPhoto?photo?=?new?AlbumPhoto();
? photo.setAlbum_photoid(rs.getInt(“album_photoid“));
? photo.setAlbum_photoname(rs.getString(“album_photoname“));
? photo.setAlbum_photourl(rs.getString(“album_photourl“));
? photo.setAlbum_photocontents(rs.getString(“album_photocontents“));
? list.add(photo);
? }
? }?catch?(SQLException?e)?{
? e.printStackTrace();
? }
? return?list;
? }
public?int?insertphoto(int?albumid?String?nameString?album_photourlString?contents)?{
int?i?=?0;
PreparedStatement?pst=?null;
Connection?con?=?ConnectionFactory.getConnection();
try?{
pst?=?con.prepareStatement(“insert?into?t_albumphoto?values(????)“);
pst.setInt(1?albumid);
pst.setString(2?name);
pst.setString(3?album_photourl);
pst.setString(4?contents);
i?=?pst.executeUpdate();
}?catch?(SQLException?e)?{
e.printStackTrace();
}
return?i;
}
public?int?insertAlbum(Album?album)?{
int?i?=?0;
PreparedStatement?pst=?null;
Connection?con?=?ConnectionFactory.getConnection();
try?{
pst?=?con.prepareStatement(“insert?into?t_album?values(????)“);
pst.setString(1?album.getAlbum_name());
pst.setString(2?album.getAlbum_content());
pst.setString(3?album.getAlbum_picurl());
pst.setInt(4?album.getUser_id());
i?=?pst.executeUpdate();
}?catch?(SQLException?e)?{
e.printStackTrace();
}
return?i;
}
public?int?deletePh
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????897??2010-08-06?10:10??網絡相冊(JSP+MSSQL)\freephoto\.classpath
?????文件????????300??2010-08-09?09:09??網絡相冊(JSP+MSSQL)\freephoto\.myme
?????文件???????1227??2010-08-06?10:10??網絡相冊(JSP+MSSQL)\freephoto\.project
?????文件????1048576??2010-09-01?15:55??網絡相冊(JSP+MSSQL)\freephoto\data\freephoto.mdf
?????文件????1048576??2010-09-01?15:55??網絡相冊(JSP+MSSQL)\freephoto\data\freephoto_date.ldf
?????文件???????3369??2010-08-06?10:11??網絡相冊(JSP+MSSQL)\freephoto\src\com\handson\dao\AlbumDao.java
?????文件???????2170??2010-08-06?10:11??網絡相冊(JSP+MSSQL)\freephoto\src\com\handson\dao\UserDao.java
?????文件????????824??2010-08-06?10:11??網絡相冊(JSP+MSSQL)\freephoto\src\com\handson\model\connection\ConnectionFactory.java
?????文件????????918??2010-08-06?10:11??網絡相冊(JSP+MSSQL)\freephoto\src\com\handson\model\vo\Album.java
?????文件???????1054??2010-08-06?10:11??網絡相冊(JSP+MSSQL)\freephoto\src\com\handson\model\vo\AlbumPhoto.java
?????文件????????566??2010-08-06?10:11??網絡相冊(JSP+MSSQL)\freephoto\src\com\handson\model\vo\User.java
?????文件???????2561??2010-08-06?10:12??網絡相冊(JSP+MSSQL)\freephoto\src\com\handson\servlet\createalbumServlet.java
?????文件???????1247??2010-08-06?10:12??網絡相冊(JSP+MSSQL)\freephoto\src\com\handson\servlet\DeleteAlbumServlet.java
?????文件???????1367??2010-08-06?10:12??網絡相冊(JSP+MSSQL)\freephoto\src\com\handson\servlet\deletePhotoServlet.java
?????文件???????1078??2010-08-06?10:12??網絡相冊(JSP+MSSQL)\freephoto\src\com\handson\servlet\exitServlet.java
?????文件???????1794??2010-08-06?10:11??網絡相冊(JSP+MSSQL)\freephoto\src\com\handson\servlet\LoginServlet.java
?????文件???????1339??2010-08-06?10:11??網絡相冊(JSP+MSSQL)\freephoto\src\com\handson\servlet\MyPhotoAlumServlet.java
?????文件???????1329??2010-08-06?10:12??網絡相冊(JSP+MSSQL)\freephoto\src\com\handson\servlet\MyPhotoServlet.java
?????文件???????1633??2010-08-06?10:12??網絡相冊(JSP+MSSQL)\freephoto\src\com\handson\servlet\NewServlet.java
?????文件???????1718??2010-08-06?10:12??網絡相冊(JSP+MSSQL)\freephoto\src\com\handson\servlet\photoServlet.java
?????文件???????2524??2010-08-06?10:12??網絡相冊(JSP+MSSQL)\freephoto\src\com\handson\servlet\UploadServlet.java
?????文件???????3018??2010-08-06?10:11??網絡相冊(JSP+MSSQL)\freephoto\src\com\handson\util\UploadImage.java
?????文件???????2406??2010-08-06?10:12??網絡相冊(JSP+MSSQL)\freephoto\WebRoot\createphotoalbum.jsp
?????文件???????5187??2010-08-06?10:12??網絡相冊(JSP+MSSQL)\freephoto\WebRoot\images\1.jpg
?????文件???????3990??2010-08-06?10:13??網絡相冊(JSP+MSSQL)\freephoto\WebRoot\images\10.jpg
?????文件???????5731??2010-08-06?10:13??網絡相冊(JSP+MSSQL)\freephoto\WebRoot\images\11.jpg
?????文件???????4490??2010-08-06?10:12??網絡相冊(JSP+MSSQL)\freephoto\WebRoot\images\12.jpg
?????文件???????4345??2010-08-06?10:13??網絡相冊(JSP+MSSQL)\freephoto\WebRoot\images\13.jpg
?????文件???????5648??2010-08-06?10:12??網絡相冊(JSP+MSSQL)\freephoto\WebRoot\images\2.jpg
?????文件???????5869??2010-08-06?10:12??網絡相冊(JSP+MSSQL)\freephoto\WebRoot\images\4.jpg
............此處省略76個文件信息
- 上一篇:畢向東Java全套.txt
- 下一篇:教學管理系統代碼java
評論
共有 條評論