SSH 技术—— 分页 、图片集合显示出来代码

 

 

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' );

==================================================

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值