"Java EE Spring" 33, the product category display of the BA-BA Sports Net

Source: Internet
Author: User

Product category display of the BA-BA Sports Network

1. Project diagram



This is a lot of pages are wrong, just a template, temporarily not used, the required code I will be all posted, and finally finished when I will send the project up

2, first we introduce the corresponding jar package


3, first we assemble the overall layout of the entire page

The material of the page I will upload, the link is: http://download.csdn.net/detail/cutter_point/8803985

Producttypeaction.java

/** * Function: This is the realization of the product class and Web layer interaction * Time: May 16, 2015 10:50:36 * file: 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{@Resourc         e Privateproducttypeservice producttypeservice;                 Privateint page; @Override publicstring Execute () throws Exception {maprequest = (MAP) ACtioncontext.getcontext (). Get ("request");                   Pageview<producttype>pageview = new Pageview<producttype> (n, This.getpage ());        Intfirstindex = (Pageview.getcurrentpage ()-1) * Pageview.getmaxresult ();                  Gets the value from which to start the index linkedhashmap<string,string> = new linkedhashmap<string, string> ();                   Orderby.put ("typeID", "desc"); QUERYRESULT&LT;PRODUCTTYPE&GT;QR = Producttypeservice.getscrolldata (Producttype.class, FirstIndex,                   Pageview.getmaxresult (), "o.visible =?", Newobject[]{true}, by-and-by);                   Pageview.setqueryresult (QR);                  Request.put ("PageView", PageView);  Producttypept = Producttypeservice.find (Producttype.class, 3);//Intmaxresult = 12; The maximum number of bars per page//longpageuse1 = Qr.gettotalrecord ()% pageview.getmaxresult ();//Longpageuse2 = Q R.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", Totalp age);//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.produ Cttypeservice= PRODUCTTYpeservice; }}


producttypelist.jsp

Page showing the product category

<%@ page iselignored= "false" Contenttype= "Text/html;charset=utf-8"%><% @taglib uri= "/struts-tags" prefix= "s "%>

4, the STRUTS2 configuration

<?xml version= "1.0" encoding= "UTF-8"? ><! DOCTYPE struts public    "-//apache software foundation//dtd strutsconfiguration 2.3//en"    "/HTTP/ Struts.apache.org/dtds/struts-2.3.dtd ">   <struts>    <include file=" Struts-default.xml "/>    <constant name= "struts. Objectfactory "value=" Spring "/><!--    means the action in this is created by spring--    <constant name=" Struts.devmode "value=" true "/>    <package name=" control "namespace="/control "extends=" Struts-default ">        <action name= "center-*" ><!--direct jump, does not require class verification, default return success--            <result name= "Success" > /page/controlcenter/{1}.jsp</result>        </action>           <action name= "ProductType" class= " Producttypeaction "method=" execute ">            <result name=" list ">/page/product/producttypelist.jsp</ Result>        </action>    


5, Next we test the effect of the page

We visit this website

Http://localhost:8080/babaSport_0800_s2sh_producttypelist_web/control/center-main

We open the product management





Unable to display because the parent class was not present

About the website why to write this, on a blog has introduced

6. Summary

In the next section we will begin to work with subclasses of subclasses of the parent class's subclasses ...

Show the problem, here we first put all the categories in the database query out, regardless of the so-called first show only the parent class problem

"Java EE Spring" 33, the product category display of the BA-BA Sports Net

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.