【j2ee spring】33、巴巴运动网的产品类别展示

巴巴运动网的产品类别展示

1、项目图解

这里面好多页面都是错的,只是个模板,暂时用不上,需要的代码我会全部贴出来,,最后做完的时候我会把项目发上来

2、首先我们引入相应的jar包

3、首先我们组装整个页面的整体格局

页面的素材我会上传的,链接是:

ProductTypeAction.java

/** * 功能:这个是实现产品类和web层的交互 * 时间:2015年5月16日10:50:36 * 文件:ProductTypeAction.java * 作者:cutter_point */packagecom.cutter_point.web.action.product;import java.util.LinkedHashMap;import java.util.Map;import javax.annotation.Resource;import org.springframework.context.annotation.Scope;importorg.springframework.stereotype.Component;import com.cutter_point.bean.PageIndex;import com.cutter_point.bean.PageView;import com.cutter_point.bean.QueryResult;import com.cutter_point.bean.WebTool;importcom.cutter_point.bean.product.ProductType;importcom.cutter_point.service.product.ProductTypeService;importcom.opensymphony.xwork2.ActionContext;importcom.opensymphony.xwork2.ActionSupport;//@Namespace("/product")@Component@Scope("prototype")public class ProductTypeAction extendsActionSupport{@ResourceprivateProductTypeService productTypeService;privateint page;@OverridepublicString execute() throws Exception{Maprequest = (Map)ActionContext.getContext().get("request");PageView<ProductType>pageview = new PageView<ProductType>(12, this.getPage());intfirstindex = (pageview.getCurrentpage() – 1) * pageview.getMaxresult();//得到从哪个开始索引的值LinkedHashMap<String,String> orderby = new LinkedHashMap<String, String>();orderby.put("typeid","desc");QueryResult<ProductType>qr = productTypeService.getScrollData(ProductType.class, firstindex,pageview.getMaxresult(), "o.visible = ?",newObject[]{true}, orderby);pageview.setQueryResult(qr);request.put("pageView",pageview);//ProductTypept = productTypeService.find(ProductType.class, 3);//intmaxresult = 12; //每页显示最多的条数//longpageuse1 = qr.getTotalrecord() % pageview.getMaxresult();//longpageuse2 = qr.getTotalrecord() / pageview.getMaxresult();//longtotalpage = pageuse1 == 0 ? pageuse2 : pageuse2 + 1;//PageIndexpageindex = WebTool.getPageIndex(pageview.getMaxresult(), this.getPage(),totalpage);//request.put("productType",qr.getResultList());//request.put("totalpage",totalpage);//System.out.println("pageindex= " + pageindex.getStartpage() + " <=> " +pageindex.getEndpage());//System.out.println(pt);return"list";}publicint getPage(){returnpage < 1 ? 1 : page;}publicvoid setPage(int page){this.page= page;}publicProductTypeService getProductTypeService(){returnproductTypeService;}publicvoid setProductTypeService(ProductTypeService productTypeService){this.productTypeService= productTypeService;}}

producttypelist.jsp

显示产品分类的页面

<%@ page isELIgnored="false"contentType="text/html;charset=UTF-8" %><%@taglib uri="/struts-tags" prefix="s"%><html><head><title>产品类别管理</title><meta http-equiv="Content-Type"content="text/html; charset=UTF-8"><link rel="stylesheet"href="../css/vip.css" type="text/css"><script type="text/javascript">//到指定的分页页面function topage(page){document.getElementById("page").value = page;//alert(document.getElementById("page").value);//document.form1.method= 'post';//document.form1.submit();var obj = document.getElementsByName("form1").item(0).submit();}</script><SCRIPT language=JavaScriptsrc="../js/FoshanRen.js"></SCRIPT></head><body bgcolor="#FFFFFF"text="#000000" marginwidth="0" marginheight="0"><form id="form11"name="form1" action="producttype"method="post"><s:hidden id="page"name="page" /> <table width="98%" border="0"cellspacing="1" cellpadding="2"align="center"><tr ><td colspan="6" bgcolor="6f8ac4" align="right" ><%@ include file="../share/fenye.jsp" %></td></tr><tr><td width="8%" bgcolor="6f8ac4"><div align="center"><fontcolor="#FFFFFF">代号</font></div></td><td width="5%" nowrapbgcolor="6f8ac4"><div align="center"><fontcolor="#FFFFFF">修改</font></div></td><td width="20%" bgcolor="6f8ac4"><div align="center"><fontcolor="#FFFFFF">产品类别名称</font></div></td><td width="10%"nowrap bgcolor="6f8ac4"><div align="center"><fontcolor="#FFFFFF">创建下级类别</font></div></td><td width="15%"bgcolor="6f8ac4"><div align="center"><fontcolor="#FFFFFF">所属父类</font></div></td><td nowrapbgcolor="6f8ac4"><div align="center"><fontcolor="#FFFFFF">备注</font></div></td></tr><!—————————LOOPSTART——————————><s:iterator value="#request.pageView.records"var="productType"><tr><td bgcolor="f5f5f5"><div align="center"><s:propertyvalue="#productType.typeid"/></div></td><td bgcolor="f5f5f5"><div align="center"><img src="../images/edit.gif"width="15" height="16"border="0"></a></div></td><td bgcolor="f5f5f5"><div align="center"><a href=""><s:property value="#productType.name"/></a></div></td><td bgcolor="f5f5f5"><div align="center"><a href="<s:url action="/control/product/type/manage"/>?method=addUI&parentid=#">创建子类别</a></div></td><td bgcolor="f5f5f5"align="center"><s:if test="%{#productType.parent!= null}"><s:property value="#productType.parent"/></s:if></td><td bgcolor="f5f5f5"><s:propertyvalue="#productType.note"/></td></tr></s:iterator><!———————-LOOPEND——————————-><tr><td bgcolor="f5f5f5" colspan="6"align="center"><table width="100%"border="0" cellspacing="1"cellpadding="3"><tr><td width="5%"></td><td width="85%"><input name="AddDic"type="button" class="frm_btn"id="AddDic" onClick="javascript:"value="添加类别">  <input name="query"type="button" class="frm_btn"id="query" onClick="javascript:"value=" 查询 ">  </td></tr></table></td></tr> </table> </form></body></html>

4、struts2的配置你说只有有缘人才可以取下,我看着你手中的戒指,想做你的有缘人,

【j2ee spring】33、巴巴运动网的产品类别展示

相关文章:

你感兴趣的文章:

标签云: