SSH 技术—— 分页 、图片集合显示出来代码
2016-12-23 19:15
477 查看
http://www.blogjava.net/BlogJava522935502/archive/2012/01/04/354039.html
——转载他人的资料,合作共享
EasyUI YEB页面工具:
http://jingyan.baidu.com/article/67508eb4342f9f9cca1ce426.html
http://www.cnblogs.com/xdp-gacl/p/4075079.html
http://www.cnblogs.com/xishuai/p/3620327.html
http://down.51cto.com/data/881896
http://jingyan.baidu.com/article/046a7b3efeeb58f9c37fa910.html
tomcat绑定域名
https://zhidao.baidu.com/question/1668020640897036427.html
http://blog.csdn.net/eson_15/article/details/51277324
商品类别管理
http://blog.csdn.net/eson_15/article/details/51347734
http://blog.csdn.net/eson_15/article/details/51479994
商品信息管理
购物车管理
========================================================
<action name="PictureAction" class="PictureAction">
<!-- 添加成功的映射页面 -->
<result name="success">/admin/pictures_list.jsp</result>
<!-- 更新成功的映射页面 -->
<result name="failure">user_update.jsp</result>
</action>
--------------------------
<property name="mappingResources">
<list>
<value>cn/itcast/shop/user/vo/User.hbm.xml</value>
<value>cn/itcast/shop/category/vo/Category.hbm.xml</value>
<value>cn/itcast/shop/product/vo/Product.hbm.xml</value>
<value>cn/itcast/shop/categorysecond/vo/CategorySecond.hbm.xml</value>
<value>cn/itcast/shop/order/vo/Order.hbm.xml</value>
<value>cn/itcast/shop/order/vo/OrderItem.hbm.xml</value>
<value>cn/itcast/shop/adminuser/vo/AdminUser.hbm.xml</value>
<value>cn/itcast/shop/video/vo/Video.hbm.xml</value>
<value>cn/itcast/shop/picture/vo/Picture.hbm.xml</value>
</list>
</property>
-------------------------------------
<bean id="PictureAction" class="cn.itcast.shop.picture.action.PictureAction" scope="prototype">
<property name="pictureService" ref="pictureService"/>
</bean>
<bean id="pictureService" class="cn.itcast.shop.picture.service.PictureService" scope="prototype">
<property name="pictureDao" ref="pictureDao"/>
</bean>
<bean id="pictureDao" class="cn.itcast.shop.picture.dao.PictureDao">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
----------------------------------
package cn.itcast.shop.picture.vo;
public class Picture
{
private int id;
private String introduce;
private String name;
private int type;
private String url;
public int getId()
{
return id;
}
public void setId(int id)
{
this.id = id;
}
public String getIntroduce()
{
return introduce;
}
public void setIntroduce(String introduce)
{
this.introduce = introduce;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public int getType()
{
return type;
}
public void setType(int type)
{
this.type = type;
}
public String getUrl()
{
return url;
}
public void setUrl(String url)
{
this.url = url;
}
}
--------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="cn.itcast.shop.picture.vo.Picture" table="picture">
<id name="id" type="java.lang.Integer" >
<column name="id" />
<generator class="native"/>
</id>
<property name="name" type="java.lang.String" >
<column name="name" length="100" not-null="false">
<comment>视频名</comment>
</column>
</property>
<property name="introduce" type="java.lang.String">
<column name="introduce" length="1000" not-null="false">
<comment>视频简介</comment>
</column>
</property>
<property name="type" type="java.lang.Integer">
<column name="type" not-null="false">
<comment>视频类型</comment>
</column>
</property>
<property name="url" type="java.lang.String">
<column name="url" length="1000" not-null="false">
<comment>视频地址</comment>
</column>
</property>
</class>
</hibernate-mapping>
-------------------------------------
package cn.itcast.shop.picture.action;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.ServletActionContext;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import cn.itcast.shop.picture.service.PictureService;
import cn.itcast.shop.picture.vo.Picture;
import cn.itcast.shop.video.service.VideoService;
import cn.itcast.shop.video.vo.Video;
public class PictureAction extends ActionSupport implements ModelDriven<Picture>{
private static final long serialVersionUID = 1L;
private Picture picture = new Picture(); //添加 set get
private PictureService pictureService; //添加 set get
@Override
public Picture getModel()
{
return picture;
}
public void setPictureService(PictureService pictureService)
{
this.pictureService = pictureService;
}
public String execute() throws Exception{
List<Picture> listPicture = pictureService.findAllPictureService();
ActionContext.getContext().getValueStack().set("listPicture", listPicture);
return SUCCESS;
}
// 后台查询所有视频的执行的方法
public String findAll() {
return "findAll";
}
}
------------------------------------
package cn.itcast.shop.picture.service;
import java.util.List;
import cn.itcast.shop.picture.dao.PictureDao;
import cn.itcast.shop.picture.vo.Picture;
public class PictureService
{
private PictureDao pictureDao;
public PictureDao getPictureDao()
{
return pictureDao;
}
public void setPictureDao(PictureDao pictureDao)
{
this.pictureDao = pictureDao;
}
public List<Picture> findAllPictureService(){
return pictureDao.findAllPictureDao();
}
}
---------------------------
package cn.itcast.shop.picture.dao;
import java.util.List;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import cn.itcast.shop.picture.vo.Picture;
public class PictureDao extends HibernateDaoSupport {
public List<Picture> findAllPictureDao(){
String hql = "from Picture";
List<Picture> list = this.getHibernateTemplate().find(hql);
return list;
}
}
-------------------------------------
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="${pageContext.request.contextPath }/style/css.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath }/style/div.css" rel="stylesheet" type="text/css" />
<script src="${pageContext.request.contextPath }/Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>
<body>
<div id="box">
<div id="left">
<div id="logo"><img src="${pageContext.request.contextPath }/images/1202.gif" width="376" height="184" /></div>
<div id="flash">
<embed align=center src=${pageContext.request.contextPath }/images/main.swf width="372" height="596 " type=application/x-shockwave-flash wmode="transparent" quality="high" ;> </embed>
</div>
</div>
<div id="main">
<div id="main_left">
<br>
<h2>图片信息列表:请点击图片标题,快快点我吧 !</h2>
<table width="500" border="1" align="center" cellspacing="20">
<s:iterator value="listPicture" >
<tr style="background-color:red;">
<td colspan="2">
<img src="${pageContext.request.contextPath }<s:property value='url' />" width="150px" height="150px">
<li><s:property value="id"/> </li>
<li><s:property value="introduce"/> </li>
<li><s:property value="name"/></li>
<li><s:property value="type"/></li>
</td>
</tr>
</s:iterator>
</table>
</div>
<br>
</div>
</div>
</body>
</html>
-------------------------------
create table picture ( id int not null primary key auto_increment ,
name varchar(100) not null ,
introduce varchar(1000) not null ,
type int not null,
url varchar(1000) not null
);
insert into picture values( 1 , '星月神话' , '古装爱情剧' , 1 , '/images/1.jpg' );
insert into picture values( 2 , '第一次爱的人' , '歌曲散发爱情' , 2 , '/images/2.jpg' );
insert into picture values( 3 , '农家乐' , '旅游导引视频' , 3 , '/images/3.jpg' );
==================================================
相关文章推荐
- OpenCV问题集锦,图片显示不出来的问题,cvWaitKey(0),不能读图片,未经处理的异常,等问题集合
- 【技术】文本替换(图片下载失败,文本便显示出来)
- OpenCV问题集锦,图片显示不出来,WaitKey(0),imread()不能读图片,未经处理的异常,等问题集合
- jasper iReport 图片web分页显示不出来的问题
- OpenCV问题集锦,图片显示不出来,WaitKey(0),imread()不能读图片,未经处理的异常,等问题集合
- servlet小总结4----在servlet中显示图片,分页技术等
- 【2015/4/19】servlet学习笔记5----显示图片和分页技术
- OpenCV问题集锦,图片显示不出来,WaitKey(0),imread()不能读图片,未经处理的异常,等问题集合
- 【SSH网上商城】分页显示图片
- C#Winform基础 picturebox显示用代码画出来的字符串图片
- 在webstorm中用代码将图片随机显示出来
- OpenCV问题集锦,图片显示不出来,WaitKey(0),imread()不能读图片,未经处理的异常,等问题集合
- ssh三大框架简单整合,struts2整合JasperReport报表、图表,解决HTML显示图片不出来,PDF中文不显示的问题
- 利用C#,SqlXml技术将NorthWind中的所有记录取出并显示出来(包括员工图片)
- 一起谈.NET技术,在ASP.NET中自动合并小图片并使用CSS Sprite显示出来
- 从数据库读出的JPG文件的字符流,转换成图片显示在页面上的相关代码
- 一个很少见的图片显示代码
- 图片文件上传入SQL库及显示代码
- 从数据库中读出图片并显示的示例代码
- 使用asp.net将图片上传并存入SqlServer中,然后从SqlServer中读取并显示出来