️
グループプロジェクト名:EasyBuy_flc または (EasyBuy_01)
チームデータベース名:EasyBuy_flc
バージョン管理ツール:svn、いいえより長く使用される
将来的には、自分のチームのプロジェクトを git にアップロードします
開発プロセス管理:
チームリーダー: すべての html ページを
jspサフィックスに変更し、データベースとデータテーブルを確立します A
チームメンバー: データベースを設計し、データテーブルの中国語フィールド名を書きますB チームメンバー: エンティティクラスを設計します
プロジェクト開発ステップ1.データベース設計
easybuy_user (ユーザーテーブル)
Table1 EU_USER_ID char
charID カード
EU_EMAIL varchar メール
====== ================================================= ======
easybuy_product_category (商品カテゴリテーブル)
テーブル2
EPS_ID=================== ======= ==============easybuy_product(商品テーブル)
テーブル3 EP_ID EP_DESCRIPTION 商品説明
C EP_PRICE商品価格
EP_STOCK商品在庫
EPC_ID現在の商品カテゴリーの親分類番号
EPC_CHILD_ID現在の商品の分類
EP_File_名前 ========= ==============================================
easybuy_order(注文テーブル)
table4
EO_ID 注文が属するユーザー
EO_USER_NAME 注文が属するユーザー(本名)
EO_USER_ADDRESS 注文配送先住所
EO_CREATE_TIME 注文成立時間
EO_COST 注文金額
EO_STATUS 注文ステータス
EO_TYPE
注文type(このプロジェクトは有効になっていません)
==================================== ============= ====easybuy_order_detail
(注文の詳細表)5
5eod_id詳細番号
================ =============================== ============
easybuy_news (ニュース表) 表6
EN_ID
EN_CONTENT ニュースコンテンツ
EN_CREATE_TIME ニュースリリース時間
=============================== === ====================
easybuy_comment (コメントフォーム) 表7
EC_ID
EC_CREATE_TIMEコメント作成時間
EC_REPLYコメント返信
EC_REPLY_TIME
EC_NICK_NAME
コメンター======== ============== ==================================== ===
2.
プロジェクトのアーキテクチャ
2.1
エンティティレイヤーから開始
エンティティレイヤーのコードは次のとおりです: ユーザー ユーザー
カテゴリ:
Product_category 製品カテゴリ:
Product 製品情報テーブル:
Order 注文テーブル:
Order_detail 注文詳細テーブル:
ニュース情報テーブル:
User_address アドレス クラス:
Count クラス:
プロジェクトの作業を開始します: 1:
package cn.com.dao;import java.sql.Connection;import java.sql.DriverManager;import java.sql.PreparedStatement;import java.sql.ResultSet;import javax.naming.Context;import javax.naming.InitialContext;import javax.sql.DataSource;public class BaseDAO {public static final String driver = "com.mysql.jdbc.Driver";public static final String url = "jdbc:mysql://localhost:3306/easybuy?useUnicode=true&charaterEncoding=UTF-8";public static final String username = "root";public static final String pwd = "1234";public Connection con=null;public PreparedStatement ps=null;public ResultSet rs=null; //获取连接getConnectionpublic Connection getConnection() throws Exception {//加载驱动 Class.forName(driver);if (con == null || con.isClosed()) { con = DriverManager.getConnection(url, username, pwd); }return con; }//查询 executeQuerypublic ResultSet executeQuery(String sql, Object...objects) throws Exception { con = getConnection(); ps = con.prepareStatement(sql);for (int i = 0; i <p>daoレイヤー: </p><p></p><pre class="brush:php;toolbar:false"> select(String name,String pwd) Exception; }
daoの実装レイヤー:
UserDaoImpl BaseDAO select(String name,String pwd) ="select count(1) from easybuy_user where loginname=? and loginname=?"=(rs!==rs.getInt("id"
サービスレイヤー:
select(String name,String pwd)
サービス実装層:
public class UserServiceImpl implements IUserService{ UserDaoImpl dao=new UserDaoImpl(); @Override public int select(String name, String pwd) throws Exception { return dao.select(name, pwd); } @Override public List<User> getAllList() throws Exception { return dao.getAllList(); } }
静的ページ:
MD5 暗号化ツール:
public class Md5Tool{ public String getMD5(String pwd){ //用于加密的字符 char md5String[] ={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; try{//使用平台的默认字符集将此String编码为bytex序列,并将结果存储到一个新的byte数组中 byte[] btInput=pwd.getBytes(); //信息摘要是安全的单向哈希函数,它接受任意大小的数据,并输出固定长度的哈希值。 MessageDigest mdInst=MessageDigest.getInstance("MD5"); //MessageDisgest对象通过使用update方法处理数据,使用指定的byte数组更新摘要 mdInst.update(btInput); //摘要更新之后,通过调用disgest()执行哈希计算,获得密文 byte[] md = mdInst.digest();//把密文转换成十六进制的字符串形式 int j=md.length; char str[] = new char[j*2]; int k=0; for(int i=0;i<j>>>4&0xf]; //5 str[k++] = md5String[byte0&0xf]; //F } //返回经过加密后的字符串return new String(str); }catch(Exception e) return null; } } }</j>
验证码问题:
1.为什么要在网站中加入验证码?
解析:为了防止机器恶意注册,1s内在我们的数据库中形成N条记录
2.验证码实现机制:
解析:为了防止浏览器读取缓存中的验证码图片,首先在形成验证码的Servlet处理程序中设置浏览器不缓存,第二种手段就是给请求的Servlet加一个随机数,这样就保证每次都从服务器拿一张验证码图片。说白了验证码就是一个服务器端的后台类(Servlet),以流的方式回送到客户端浏览器,用img标签承载。
3.雕虫小技
解析:验证的时候先进行验证码的校验,如果发现验证码不匹配, 就不用再验证用户名和密码,这样就省去了和数据库的一次交互。
验证码工具书写:
package cn.buy.util;import java.awt.Color;import java.awt.Font;import java.awt.Graphics;import java.awt.image.BufferedImage;import java.util.Random;public class AuthCode {public static final int AUTHCODE_LENGTH = 5; //验证码长度 public static final int SINGLECODE_WIDTH = 15; //单个验证码宽度 public static final int SINGLECODE_HEIGHT = 30; //单个验证码高度 public static final int SINGLECODE_GAP = 4; //单个验证码之间间隔 public static final int IMG_WIDTH = AUTHCODE_LENGTH * (SINGLECODE_WIDTH + SINGLECODE_GAP); public static final int IMG_HEIGHT = SINGLECODE_HEIGHT; public static String getAuthCode() { String authCode = ""; for(int i = 0; i
验证码的servlet书写:
public class AuthCodeServlet extends HttpServlet {public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException { doPost(request, response); }public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException { String authCode = AuthCode.getAuthCode(); request.getSession().setAttribute("authCode", authCode); //将验证码保存到session中,便于以后验证 try { //发送图片 ImageIO.write(AuthCode.getAuthImg(authCode), "JPEG", response.getOutputStream()); } catch (IOException e){ e.printStackTrace(); } } }
验证码的Ajax,,登录的效验,,鼠标悬停和离开:
前台页面显示js:
1.光标的显示和离开
2.验证码的显示
<script>$(function() { $("#myid").click(function() { $.ajax({ url : "/EasyBuy/AuthCodeServlet", type : "get", success : function(dom) { document.getElementById("authImg").src = "AuthCodeServlet"; } }); }); }); $(function(){ var erro=0; $(".l_user").focus(function() { $("#lid").html("请输入用户名"); }); $(".l_user").blur(function(){if($(this).val()==""){ $("#lid").html(""); }else if ($(this).val() != "" && /^[a-zA-Z]{1}([a-zA-Z]|[0-9]){4,15}$/.test($(this).val())) { $("#lid").html(""); } else { $("#lid").html("请输入正确的用户名(首字母为英文,5-15位)"); } }); $(".l_pwd").focus(function(){ $("#pid").html("请输入密码"); }); $(".l_pwd").blur(function(){if($(this).val()==""){ erro=1; $("#pid").html(""); }else if ($(this).val() != "" && /^.{1,16}$/.test($(this).val())) { erro=0; $("#pid").html(""); } else { $("#pid").html("密码格式不正确"); erro=1; } }); }); function checks(myform) {if (myform.luser.value == "") { $("#lid").html("请输入用户名");return false; }else if (myform.lpwd.value =="") { $("#pid").html("请输入密码");return false; }return true; } </script>
根据前台页面表单里action的跳转:servelet:
Md5Tool md5Tool=new Md5Tool(); IUserService service = new UserServiceImpl();if("login".equals(resquest.getParameter("title")){ String name=request.getParameter("luser"); String pwds=request.getParameter("lpwd");if(name==null&&pwds==null){ response.sendRedirect("/EasyBuy/Login.jsp"); }else{ name=new String(name.getBytes("iso-8859-1"),"utf-8"); pwds=new String(pwds.getBytes("iso-8859-1"),"utf-8"); String mm=(String)request.getSession().getAttribute("authCode"); String yy=request.getParameter("yzm"); //获取验证码if(!yy.equest(mm)){ request.getSession().setAttribute("mm","flag"); response.sendRedirect("/EasyBuy/Login.jsp"); }else{try{ request.getSession().setAttribute("user",service.getAllList(name)); pwds=md5Tool.getMD5(pwds); int num=service.select(name,pwds); if(num>0){ request.setAttribute("uname".service.getAllList(name).getUserName()); request.getRequestDispatcher("/Index.jsp").forward(request,response); }else{ response.sendRedirect("/EasyBuy/Login.jsp"); } }catch(Exception e){ e.printStackTrace(); } } } } }
2.注册:
效果图:
输入正确后即可显示登陆
在dao层:
public interface IUserDao {//插入用户信息传递一个用户对象public int add(User users) throws Exception; }
dao实现层:
public class UserDaoImpl extends BaseDAO implements IUserDao{ @Overridepublic int add(User users) throws Exception { String sql="insert into easybuy_user values(null,?,?,?,?,?,?,?,0)"; Object[] obj={users.getLoginName(),users.getUserName(),users.getPassword(),users.getSex(),users.getIdentityCode(),users.getEmail(),users.getMobile()};int num = executeUpdate(sql, obj);return num; } }
services层:
add(User users) throws Exception; }
services实现层:
public class UserServiceImpl implements IUserService{ UserDaoImpl dao=new UserDaoImpl(); @Overridepublic int add(User users) throws Exception { return dao.add(users); } }
在我的servlet层:
Md5Tool md5Tool = (.equals(request.getParameter(= = = <fileitem> items =<fileitem> iter == == (filename.equals(.println(fileItem.getString( (filename.equals(.println(fileItem.getString( (filename.equals(.println(fileItem.getString( (filename.equals(= fileItem.getString( (sex.equals( (sex.equals( (filename.equals( (filename.equals( (filename.equals( (filename.equals(== fileItem.getString( (!= num = (num ></fileitem></fileitem>
我的前台页面:
jq的实现:
<script> $(function(){ $("#myid").click(function(){ $.ajax({ url:"/EasyBuy/AuthCodeServlet", type:"get", success:function(){ document.getElementById("authImg").src ="AuthCodeServlet"; } }); }); $(".l_user").blur(function(){ $.ajax({ type:"get", url:"<%=path%>/LoginServlet?login="+$(".l_user").val(), success:function(dom){if(dom){ $("#uid").html("用户名已被注册,请重新命名"); } } }); }); }); </script>
3.我的新闻资讯:
页面显示:
点更多的时候:
在我的dao层:
public interface INewsDAO{ //查询资讯//资讯的分页 public List<news> newsList(int pageSize, int PageIndex) throws Exception;//咨询的数量,配合分页一起 public int newscount() throws Exception;//根据我的id查资讯 public List<news> newsList(String id) throws Exception; }</news></news>
在我的dao层的查数据:
public class NewsDAOImpl extends BaseDAO implements INewsDAO{ @Override public List<news> newsList(String id) throws Exception{//新闻放到集合里List<news> list = new ArrayList<news>();//把sql语句放到结果集里ResultSet rs=executeQuery("select * from easybuy_news where id=? LIMIT 0,1",id);//调用我的工具类Tool<news> tool = new Tool<news>();//将我的rs对象转成集合了list.add(tool.list(rs,News.class).get(0));//查询我的分页数据,上一页,下一页。rs=executeQuery("select * from (select * from easybuy_news order by id desc) a where id order by id desc LIMIT 0,1",id);if(rs.next()){ rs=executeQuery("select * from (select * from easybuy_news order by id desc) a where id order by id desc LIMIT 0,1",id); list.add(tool.list(rs,News.class).get(0)); }else{ list.add(null); } rs=executeQuery("select * from easybuy_news where id>? LIMIT 0,1",id);if(rs.next()){ rs=executeQuery("select * from easybuy_news where id>? LIMIT 0,1",id); list.add(tool.list(rs,News.class).get(0)); } close();return list; } @Overridepublic List<news> newsList(int pageSize, int PageIndex) throws Exception{ ResultSet rs=executeQuery(“select * from easybuy_news order by id desc LIMIT ?,?”,(PageIndex-1)*pageSize,pageSize); Tool<news> tool = new Tool<news>(); List<news> list = tool.list(rs,News.class); close();return list; } @Overridepublic int newscount() throws Exception{ int count=0; ResultSet rs=executeQuery("select count(1) from easybuy_news"); if(rs.next()){ count=rs.getInt(1); } return count; } }</news></news></news></news></news></news></news></news></news>
Tool工具类:
public class Tool<t> { @SuppressWarnings("unchecked")public List<t> list(ResultSet rs,Class<t> cls) throws Exception{ List<t> list=new ArrayList<t>(); Field[] fields = cls.getDeclaredFields();if(rs!=null){while (rs.next()) { Object obj=cls.newInstance();for (Field field : fields) { String name=field.getName(); Method method = cls.getDeclaredMethod("set"+name.substring(0,1).toUpperCase()+name.substring(1),field.getType());try { method.invoke(obj,rs.getObject(name)); } catch (Exception e) {continue; } } list.add((T)obj); } }return list; } }</t></t></t></t></t>
在我的services层:
public interface INewsService {//查询资讯public List<news> newsList(int pageSize, int PageIndex) throws Exception;public int newscount() throws Exception;public List<news> newsList(String id) throws Exception; }</news></news>
services实现层:
public class NewsServiceImpl implements INewsService{ INewsDAO dao=new NewsDAOImpl(); @Overridepublic List<news> newsList(int pageSize, int PageIndex) throws Exception { return dao.newsList(pageSize,PageIndex); } @Overridepublic List<news> newsList(String id) throws Exception {return dao.newsList(id); } @Overridepublic int newscount() throws Exception {return dao.newscount(); } }</news></news>
我的servlet层:
public class NewsServlet extends HttpServlet {public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); }public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { INewsService Service=new NewsServiceImpl(); String type=request.getParameter("type"); String id=request.getParameter("id"); String pageindex=request.getParameter("pageindex"); Page<news> page=new Page<news>();try {if("top5news".equals(type)){ request.setAttribute("News",Service.newsList(id)); }else if("newstable".equals(type)||(pageindex!=null&&!"".equals(pageindex))){if(pageindex!=null&&!"".equals(pageindex)){ page.setPageIndex(Integer.parseInt(pageindex)); } page.setPageCount(Service.newscount()); page.setPageList(Service.newsList(page.getPageSize(), page.getPageIndex())); request.setAttribute("page",page); } request.getRequestDispatcher("MyJsp.jsp").forward(request, response); } catch (Exception e) { e.printStackTrace(); } } }</news></news>
在我的前台页面:
index.jsp
<div> <span><a>更多 </a></span>新闻资讯</div>
- [ 特惠 ]${item.title }
集合NewsList在三级分类里:
//资讯集合request.setAttribute("clist", list); request.setAttribute("NewsList",newsService.newsList(5,1)); request.getRequestDispatcher(url).forward(request, response);
index.jsp:
<set> </set> <div></div><p>title.jsp:</p><div class="cnblogs_code"><pre class="brush:php;toolbar:false"> <if> <forward></forward> </if> <div> <div> <span> <span>加入收藏</span> </span> <span> <span>送货至:</span> <span> <span>四川</span> <div> <div></div> <div> <h2 id="请选择所在的收货地区">请选择所在的收货地区</h2> <table> <tr> <th>A</th> <td> <span>安徽</span><span>澳门</span> </td> </tr> <tr> <th>B</th> <td><span>北京</span></td> </tr> <tr> <th>C</th> <td><span>重庆</span></td> </tr> <tr> <th>F</th> <td><span>福建</span></td> </tr> <tr> <th>G</th> <td> <span>广东</span><span>广西</span><span>贵州</span><span>甘肃</span> </td> </tr> <tr> <th>H</th> <td> <span>河北</span><span>河南</span><span>黑龙江</span><span>海南</span><span>湖北</span><span>湖南</span> </td> </tr> <tr> <th>J</th> <td> <span>江苏</span><span>吉林</span><span>江西</span> </td> </tr> <tr> <th>L</th> <td><span>辽宁</span></td> </tr> <tr> <th>N</th> <td> <span>内蒙古</span><span>宁夏</span> </td> </tr> <tr> <th>Q</th> <td><span>青海</span></td> </tr> <tr> <th>S</th> <td> <span>上海</span><span>山东</span><span>山西</span><span>四川</span><span>陕西</span> </td> </tr> <tr> <th>T</th> <td> <span>台湾</span><span>天津</span> </td> </tr> <tr> <th>X</th> <td> <span>西藏</span><span>香港</span><span>新疆</span> </td> </tr> <tr> <th>Y</th> <td><span>云南</span></td> </tr> <tr> <th>Z</th> <td><span>浙江</span></td> </tr> </table> </div> </div> </span> </span> <span> <span> <div></div> <if>你好,欢迎您:<a>${user.userName }</a> | <a>我的订单</a> |<a>注销</a> </if> <if> 你好,请<a>登录</a> <a>免费注册</a> </if> </span> <span> <div> <a>收藏夹</a> <div> <div></div> <div> <ul> <div>暂无收藏商品!</div> </ul> </div> </div> </div> <div> <a>客户服务</a> <div> <div></div> <div> <ul> <li><a>售后流程</a></li> <li><a>订购方式</a></li> <li><a>隐私声明</a></li> </ul> </div> </div> </div> <div> <a>网站导航</a> <div> <div></div> <div> <ul> <li><a>精品女装</a></li> <li><a>生活电器</a></li> </ul> </div> </div> </div> </span> <span>| 关注我们:</span> <span><a>新浪</a><a>微信</a></span> <span>| <a>手机版 <img src="/static/imghwm/default1.png" data-src="images/s_tel.png" class="lazy" alt="Yimai.com プロジェクトのサンプル チュートリアルを共有する" ></a></span> </span> </div> </div> <div> <div><a><img src="/static/imghwm/default1.png" data-src="images/logo.png" class="lazy" alt="Yimai.com プロジェクトのサンプル チュートリアルを共有する" ></a></div> <div> <form> <input> <input> </form> <span> <a>咖啡</a> <a>iphone 6S</a> <a>新鲜美食</a> <a>蛋糕</a> <a>日用品</a> <a>连衣裙</a> </span> </div> <div> <if> <div>购物车 [ <span>${pcount}</span> ]</div> </if> <if> <div>购物车 [ <span>0</span> ]</div> </if> <div> <if> <!--Begin 购物车未登录 Begin--> <div>还未登录!<a>马上登录</a> 查看购物车!</div> <!--End 购物车未登录 End--> </if> <!--Begin 购物车已登录 Begin--> <if> <ul> <if> <foreach> <li> <div><a><img src="/static/imghwm/default1.png" data-src="images/${item.fileName }" class="lazy" alt="Yimai.com プロジェクトのサンプル チュートリアルを共有する" ></a></div> <div><a>${item.name }</a></div> <div> <font>${item.price }</font> X${item.count }</div> </li> </foreach> </if> </ul> <if>0}"> <div> <div>共计 <font>¥</font><span>${pprice }</span> </div> <div><a>去购物车结算</a></div> </div> </if> <if> <div> <div>购物车内还没有商品,赶快选购吧!</div> </div> </if> </if> <!--End 购物车已登录 End--> </div> </div> </div> <!--End Header End--> <!--Begin Menu Begin--> <script>function deleteCartGoods(rec_id) { Ajax.call('delete_cart_goods.php', 'id='+rec_id, deleteCartGoodsResponse, 'POST', 'JSON'); }/** * 接收返回的信息 */function deleteCartGoodsResponse(res) { if (res.error) { alert(res.err_msg); } else { document.getElementById('ECS_CARTINFO').innerHTML = res.content; } }</script>
在我的sevlet:
package cn.buy.servlet; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.ServletException; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import cn.buy.entity.Product; import cn.buy.entity.Product_category; import cn.buy.service.INewsService; import cn.buy.service.IProductService; import cn.buy.service.IProduct_categoryService; import cn.buy.service.impl.NewsServiceImpl; import cn.buy.service.impl.ProductServiceImpl; import cn.buy.service.impl.Product_categoryServiceImpl;public class Product_categoryServlet extends HttpServlet {public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {//三级列表IProduct_categoryService service = new Product_categoryServiceImpl();//资讯INewsService newsService=new NewsServiceImpl();//获取请求页面urlString url=(String)request.getAttribute("url"); Map<product_category>>> map = new HashMap<product_category>>>();try {for (Product_category oneitem : service.oneList()) { Map<product_category>> twomap=new HashMap<product_category>>();for (Product_category twoitem : service.twoList(oneitem.getId())) { List<product_category> list=new ArrayList<product_category>();for (Product_category threeitem : service.threeList(twoitem.getId())){ list.add(threeitem); } twomap.put(twoitem, list); } map.put(oneitem, twomap); }//三级列表集合request.setAttribute("map",map); IProductService service1 = new ProductServiceImpl(); List<product> list = new ArrayList<product>(); Cookie[] cookies = request.getCookies();int j = 0;for (int i = cookies.length-1; i >= 1; i--) {if (cookies[i].getValue().equals("id")) { j++;if (j </product></product></product_category></product_category></product_category></product_category></product_category></product_category>
我的三级菜单:
package cn.buy.servlet; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.servlet.ServletException; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.swing.RepaintManager; import net.sf.json.JSONArray; import net.sf.json.JSONObject; import cn.buy.entity.Count; import cn.buy.entity.News; import cn.buy.entity.Product; import cn.buy.service.IProductService; import cn.buy.service.impl.ProductServiceImpl; import cn.buy.util.Page;public class ProductServlet extends HttpServlet { String name=null;public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {if(name==null&&request.getParameter("keywords")!=null){ name = new String(request.getParameter("keywords").getBytes("ISO-8859-1"),"utf-8"); } doPost(request, response); }public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8"); IProductService service = new ProductServiceImpl(); String id=request.getParameter("id"); String type=request.getParameter("type"); String oneid = request.getParameter("oneid"); String twoid = request.getParameter("twoid"); String threeid = request.getParameter("threeid"); String pcount = request.getParameter("pcount"); String pageindex=request.getParameter("pageindex"); Page<product> page=new Page<product>();if(name==null){ name = request.getParameter("keywords"); }if ("fl".equals(type)) {try { page.setPageSize(4);if(pageindex!=null&&!"".equals(pageindex)){ page.setPageIndex(Integer.parseInt(pageindex)); }if (oneid != null && !"".equals(oneid)) { page.setPageCount(service.pcount(oneid, "one")); page.setPageList(service.List(page.getPageSize(), page.getPageIndex(),oneid,"one")); request.setAttribute("count",service.pcount(oneid, "one")); request.setAttribute("oneid", oneid); } else if (twoid != null && !"".equals(twoid)) { page.setPageCount(service.pcount(twoid, "two")); page.setPageList(service.List(page.getPageSize(), page.getPageIndex(),twoid,"two")); request.setAttribute("count",service.pcount(twoid, "two")); request.setAttribute("twoid", twoid); } else if (threeid != null && !"".equals(threeid)) { page.setPageCount(service.pcount(threeid, "three")); page.setPageList(service.List(page.getPageSize(), page.getPageIndex(),threeid,"three")); request.setAttribute("count",service.pcount(threeid, "three")); request.setAttribute("threeid", threeid); }else if (name != null) { page.setPageCount(service.pcount(name, "ss")); page.setPageList(service.List(page.getPageSize(), page.getPageIndex(),name,"ss")); request.setAttribute("count",service.pcount(name, "ss")); request.setAttribute("ss",name); name=null; } } catch (Exception e) { e.printStackTrace(); } request.setAttribute("page",page); request.getRequestDispatcher("BrandListjsp").forward(request, response); }else if("gwc".equals(type)){ List<product> plist=(List<product>)request.getSession().getAttribute("plist");if(plist==null){ plist=new ArrayList<product>(); }int count=0;double price=0; boolean flag=true;try {if(pcount==null||"".equals(pcount)){ pcount="1"; }for (Product item : plist) {if(item.getId()==Integer.parseInt(id) ){ item.setCount(item.getCount()+Integer.parseInt(pcount)); flag=false;break; } } if(flag&&pcount!=null&&!"".equals(pcount)){ Product product=service.List(id); product.setCount(Integer.parseInt(pcount)); plist.add(product); } for (Product item : plist) { count+=item.getCount(); price+=item.getCount()*item.getPrice(); }for (Product item : plist) { item.setCount1(count); item.setPrice1(price); } JSONArray jsonArray=JSONArray.fromObject( plist); request.getSession().setAttribute("plist",plist); request.getSession().setAttribute("pprice",price); request.getSession().setAttribute("pcount",count); response.getWriter().print(jsonArray); } catch (Exception e) { e.printStackTrace(); } }else if("jia".equals(type)||"jian".equals(type)){int count=0;double price=0; List<product> plist=(List<product>)request.getSession().getAttribute("plist");for (Product item : plist) {if(item.getId()==Integer.parseInt(id) ){if("jia".equals(type)){ item.setCount(item.getCount()+1); }else{ item.setCount(item.getCount()-1); }break; } }for (Product item : plist) { count+=item.getCount(); price+=item.getCount()*item.getPrice(); }for (Product item : plist) { item.setCount1(count); item.setPrice1(price); } JSONArray jsonArray=JSONArray.fromObject( plist); response.getWriter().print(jsonArray); request.getSession().setAttribute("plist",plist); request.getSession().setAttribute("pprice",price); request.getSession().setAttribute("pcount",count); }else if("de".equals(type)){ response.getWriter().print(id); }else if("delete".equals(type)||"qk".equals(type)){int count=0;double price=0; List<product> plist=(List<product>)request.getSession().getAttribute("plist");if("delete".equals(type)){for (int i=0;i<plist.size></plist.size></product></product></product></product></product></product></product></product></product>
单点的一个跳转:分页中的下一篇和上一篇
<div> <p>[特惠]${News[0].title }</p> <p><b>${News[0].brief }/${News[0].createTime }</b> </p> </div> <div></div> ${News[0].content} <div> <object> <param> <param> <param> <embed></embed></object> </div> <div></div> <div> <if>下一篇:<a>${News[1].title }</a><br> </if> <if> 上一篇:<a>${News[2].title }</a><br> </if> </div> <div></div>
商品分类:
前台:
nbsp;html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""> <meta> <link> <!--[if IE 6]> <script src="js/iepng.js" type="text/javascript"></script> <script type="text/javascript"> EvPNG.fix('div, ul, img, li, input, a'); </script> <![endif]--> <script></script> <script></script> <script></script> <script></script> <script></script> <link> <link> <script></script> <script>var jq = jQuery.noConflict();</script> <script></script> <script></script> <script>$(function(){ $(".mya").click(function(){ <c:if test="${user==null}"> location.href="Login.jsp?tz=1"; $.ajax({ url:"/EasyBuy/ProductServlet?id="+$product.id+"&type=gwc&pcount="+$("#myinput").val(), type:"get", dataType: "json", success:function(data){var li="";var count=0;var count1=0;var price1=0; $.each(data,function(i,item){ count++; if(i==0){ $("#div").html("<div class='price_sum'>共计 <font color='#ff4e00'>¥<span id='zj'>${pprice }</script>
${product.name }
“开业巨惠,北京专柜直供”,不光低价,“真”才靠谱!消费积分:28R
- 30ml
- 50ml
- 100ml
- 红色
- 白色
- 黑色
商品名称:迪奥香水 | 商品编号:1546211 | 品牌: 迪奥(Dior) | 上架时间:2015-09-06 09:19:09 |
商品毛重:160.00g | 商品产地:法国 | 香调:果香调香型:淡香水/香露EDT | |
容量:1ml-15ml | 类型:女士香水,Q版香水,组合套装 |
![]() |
迪奥真我香水(Q版) 【商品规格】:5ml 【商品质地】:液体 【商品日期】:与专柜同步更新 【商品产地】:法国 【商品包装】:无外盒 无塑封 【商品香调】:花束花香调 【适用人群】:适合女性(都市白领,性感,有女人味的成熟女性) |
![]() |
正品保障正品行货 放心购买 |
![]() |
满38包邮满38包邮 免运费 |
![]() |
天天低价天天低价 畅选无忧 |
![]() |
准时送达收货时间由你做主 |








我的订单:
<div> <div>管理中心</div> <div> <div>订单中心</div> <ul> <li><a>我的订单</a></li> <li><a>收货地址</a></li> </ul> </div> <div> <div>会员中心</div> <ul> <li><a>用户信息</a></li> <li><a>我的收藏</a></li> <li><a>我的留言</a></li> <li><a>推广链接</a></li> <li><a>我的评论</a></li> </ul> </div> <div> <div>账户中心</div> <ul> <li><a>账户安全</a></li> </ul> </div> </div>
我的订单OrderServlet类:
package cn.buy.servlet; import java.io.IOException; import java.io.PrintWriter; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import cn.buy.entity.Count; import cn.buy.entity.Order; import cn.buy.entity.Product; import cn.buy.entity.User; import cn.buy.service.IOrderSerice; import cn.buy.service.IRessService; import cn.buy.service.impl.OrderServiceImpl; import cn.buy.service.impl.RessServiceImpl; import cn.buy.util.Md5Tool;public class OrderServlet extends HttpServlet {public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); }public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { User user= ((User)request.getSession().getAttribute("user")); IRessService ress=new RessServiceImpl(); IOrderSerice serice=new OrderServiceImpl(); String type=request.getParameter("type");if("cx".equals(type)){try { request.setAttribute("list",serice.orders(user.getId()+"")); request.getRequestDispatcher("/Member_Order.jsp").forward(request, response); } catch (Exception e) { e.printStackTrace(); } }else{ Md5Tool md5Tool=new Md5Tool(); List<product> list=(List<product>)request.getSession().getAttribute("plist"); double pprice=(Double)request.getSession().getAttribute("pprice"); Order order=new Order(); order.setCost(pprice); order.setLoginName(user.getLoginName()); order.setUserId(user.getId()); Date date=new Date(); DateFormat format=new SimpleDateFormat("yyyyMMddHHmmss"); String time=format.format(date); order.setSerialNumber( md5Tool.getMD5(time+user.getId())); try { order.setUserAddress(ress.Ress(user.getId()+"").getAddress());int id=serice.addorder(order);for (Product item : list) { serice.adddetail(id+"",item.getId()+"",item.getCount(), item.getCount()*item.getPrice()); } request.getSession().setAttribute("pprice",null); request.getSession().setAttribute("pcount",null); request.getSession().setAttribute("plist",null); request.setAttribute("ddbh", md5Tool.getMD5(time+user.getId())); request.setAttribute("price",pprice); request.getRequestDispatcher("BuyCar_Three.jsp").forward(request, response); }catch (Exception e) { e.printStackTrace(); } } } }</product></product>
订单的主要代码:
package cn.buy.dao.impl; import java.nio.channels.SelectableChannel; import java.sql.ResultSet; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import cn.buy.dao.BaseDAO; import cn.buy.dao.IOrderDAO; import cn.buy.entity.Order; import cn.buy.util.Tool;public class OrderDAOImpl extends BaseDAO implements IOrderDAO{ @Overridepublic int addorder(Order order) throws Exception { Date date=new Date(); DateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String time=format.format(date);int count=executeUpdate("insert into easybuy_order values(?,?,?,?,?,?,?)",null,order.getUserId(),order.getLoginName(),order.getUserAddress(),time,order.getCost(),order.getSerialNumber());if(count>0){ ResultSet rs=executeQuery("SELECT id FROM easybuy_order ORDER BY id DESC LIMIT 1 ");if(rs.next()){ count=rs.getInt(1); } } close();return count; } @Overridepublic boolean adddetail(String oid, String pid, int quantity, double cost) throws Exception {int count=executeUpdate("insert into easybuy_order_detail values (?,?,?,?,?)",null,oid,pid,quantity,cost); close();return count>0? true : false; } @Overridepublic List<order> orders(String userid) throws Exception { ResultSet rs=executeQuery("select * from easybuy_order where userid=?", userid); List<order> list=new ArrayList<order>();if(rs!=null){while(rs.next()){ Order order=new Order(); order.setCost(rs.getDouble("Cost")); order.setCreateTime(rs.getString("CreateTime")); order.setId(rs.getInt("Id")); order.setLoginName(rs.getString("LoginName")); order.setSerialNumber(rs.getString("SerialNumber")); order.setUserAddress(rs.getString("UserAddress")); order.setUserId(rs.getInt("UserId")); list.add(order); } } close();return list; } }</order></order></order>
商品详情:
我的另一个:
我的商品详情的前台页面:
nbsp;html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""> <meta> <link> <!--[if IE 6]> <script src="js/iepng.js" type="text/javascript"></script> <script type="text/javascript"> EvPNG.fix('div, ul, img, li, input, a'); </script> <![endif]--> <script></script> <script></script> <script></script> <script></script> <script></script> <link> <link> <script></script> <script>var jq = jQuery.noConflict();</script> <script></script> <script></script> <script>$(function(){ $(".mya").click(function(){ <c:if test="${user==null}"> location.href="Login.jsp?tz=1"; $.ajax({ url:"/EasyBuy/ProductServlet?id="+$product.id+"&type=gwc&pcount="+$("#myinput").val(), type:"get", dataType: "json", success:function(data){var li="";var count=0;var count1=0;var price1=0; $.each(data,function(i,item){ count++; if(i==0){ $("#div").html("<div class='price_sum'>共计 <font color='#ff4e00'>¥<span id='zj'>${pprice }</script>
${product.name }
“开业巨惠,北京专柜直供”,不光低价,“真”才靠谱!消费积分:28R
- 30ml
- 50ml
- 100ml
- 红色
- 白色
- 黑色
商品名称:迪奥香水 | 商品编号:1546211 | 品牌: 迪奥(Dior) | 上架时间:2015-09-06 09:19:09 |
商品毛重:160.00g | 商品产地:法国 | 香调:果香调香型:淡香水/香露EDT | |
容量:1ml-15ml | 类型:女士香水,Q版香水,组合套装 |
![]() |
迪奥真我香水(Q版) 【商品规格】:5ml 【商品质地】:液体 【商品日期】:与专柜同步更新 【商品产地】:法国 【商品包装】:无外盒 无塑封 【商品香调】:花束花香调 【适用人群】:适合女性(都市白领,性感,有女人味的成熟女性) |
![]() |
正品保障正品行货 放心购买 |
![]() |
满38包邮满38包邮 免运费 |
![]() |
天天低价天天低价 畅选无忧 |
![]() |
准时送达收货时间由你做主 |








商品详情图片的一个放大的效果:
前台image图片的代码:
<div> <div><a><img src="/static/imghwm/default1.png" data-src="images/${product.fileName }" class="lazy" alt="Yimai.com プロジェクトのサンプル チュートリアルを共有する" ></a></div> <img class="MagicZoomLoading lazy" src="/static/imghwm/default1.png" data-src="images/loading.gif" alt="Yimai.com プロジェクトのサンプル チュートリアルを共有する" > </div>
引入外界的css和js:
<link> <link> <script></script>
MagicZoom.js代码:
var MagicZoom_ua = 'msie';var W = navigator.userAgent.toLowerCase();if (W.indexOf("opera") != -1) { MagicZoom_ua = 'opera'} else if (W.indexOf("msie") != -1) { MagicZoom_ua = 'msie'} else if (W.indexOf("safari") != -1) { MagicZoom_ua = 'safari'} else if (W.indexOf("mozilla") != -1) { MagicZoom_ua = 'gecko'}var MagicZoom_zooms = new Array(); function _el(id) {return document.getElementById(id) }; function MagicZoom_getBounds(e) {if (e.getBoundingClientRect) {var r = e.getBoundingClientRect();var wx = 0;var wy = 0;if (document.body && (document.body.scrollLeft || document.body.scrollTop)) { wy = document.body.scrollTop; wx = document.body.scrollLeft } else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) { wy = document.documentElement.scrollTop; wx = document.documentElement.scrollLeft }return {'left': r.left + wx,'top': r.top + wy,'right': r.right + wx,'bottom': r.bottom + wy } } } function MagicZoom_getEventBounds(e) {var x = 0;var y = 0;if (MagicZoom_ua == 'msie') { y = e.clientY; x = e.clientX;if (document.body && (document.body.scrollLeft || document.body.scrollTop)) { y = e.clientY + document.body.scrollTop; x = e.clientX + document.body.scrollLeft } else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) { y = e.clientY + document.documentElement.scrollTop; x = e.clientX + document.documentElement.scrollLeft } } else { y = e.clientY; x = e.clientX; y += window.pageYOffset; x += window.pageXOffset }return {'x': x,'y': y } } function MagicView_ia() {return false};var MagicZoom_extendElement = function() {var args = arguments;if (!args[1]) args = [this, args[0]];for (var property in args[1]) args[0][property] = args[1][property];return args[0] }; function MagicZoom_addEventListener(obj, event, listener) {if (MagicZoom_ua == 'gecko' || MagicZoom_ua == 'opera' || MagicZoom_ua == 'safari') {try { obj.addEventListener(event, listener, false) } catch(e) { alert("MagicZoom error: " + e + ", event=" + event) } } else if (MagicZoom_ua == 'msie') { obj.attachEvent("on" + event, listener) } }; function MagicZoom_removeEventListener(obj, event, listener) {if (MagicZoom_ua == 'gecko' || MagicZoom_ua == 'opera' || MagicZoom_ua == 'safari') { obj.removeEventListener(event, listener, false) } else if (MagicZoom_ua == 'msie') { obj.detachEvent("on" + event, listener) } }; function MagicZoom_concat() {var result = [];for (var i = 0; i <img src="/static/imghwm/default1.png" data-src="' + this.settings[" class="lazy" alt="Yimai.com プロジェクトのサンプル チュートリアルを共有する" >';this.smallImageCont.appendChild(this.loadingCont) }this.baseuri = '';this.safariOnLoadStarted = false; MagicZoom_zooms.push(this);this.checkcoords_ref = MagicZoom_createMethodReference(this, "checkcoords") }; MagicZoom.prototype.stopZoom = function() { MagicZoom_removeEventListener(window.document, "mousemove", this.checkcoords_ref);if (this.settings["position"] == "custom") { _el(this.smallImageCont.id + "-big").removeChild(this.bigImageCont) } }; MagicZoom.prototype.checkcoords = function(e) {var y = 0;var x = 0; r = MagicZoom_getEventBounds(e); x = r['x']; y = r['y'];var smallY = 0;var smallX = 0;var tag = this.smallImage;while (tag && tag.tagName != "body" && tag.tagName != "HTML") { smallY += tag.offsetTop; smallX += tag.offsetLeft; tag = tag.offsetParent }if (MagicZoom_ua == 'msie') { r = MagicZoom_getBounds(this.smallImage); smallX = r['left']; smallY = r['top'] }if (x > parseInt(smallX + this.smallImageSizeX)) {this.hiderect();return false}if (x parseInt(smallY + this.smallImageSizeY)) {this.hiderect();return false}if (y = this.smallImageSizeX) {this.positionX = this.smallImageSizeX - this.popupSizeX / 2}if ((this.positionY + this.popupSizeY / 2) >= this.smallImageSizeY) {this.positionY = this.smallImageSizeY - this.popupSizeY / 2}if ((this.positionX - this.popupSizeX / 2) this.smallImageSizeX) {this.popupSizeX = this.smallImageSizeX }if (this.popupSizeY > this.smallImageSizeY) {this.popupSizeY = this.smallImageSizeY }this.pup.style.width = this.popupSizeX + 'px';this.pup.style.height = this.popupSizeY + 'px'}; MagicZoom.prototype.initPopup = function() {this.pup = document.createElement("DIV");this.pup.className = 'MagicZoomPup';this.pup.style.zIndex = 10;this.pup.style.visibility = 'hidden';this.pup.style.position = 'absolute';this.pup.style["opacity"] = parseFloat(this.settings['opacity'] / 100.0);this.pup.style["-moz-opacity"] = parseFloat(this.settings['opacity'] / 100.0);this.pup.style["-html-opacity"] = parseFloat(this.settings['opacity'] / 100.0);this.pup.style["filter"] = "alpha(Opacity=" + this.settings['opacity'] + ")";this.recalculatePopupDimensions();this.smallImageCont.appendChild(this.pup);this.smallImageCont.unselectable = "on";this.smallImageCont.style.MozUserSelect = "none";this.smallImageCont.onselectstart = MagicView_ia;this.smallImageCont.oncontextmenu = MagicView_ia }; MagicZoom.prototype.initBigContainer = function() {var bigimgsrc = this.bigImage.src;while (this.bigImageCont.firstChild) {this.bigImageCont.removeChild(this.bigImageCont.firstChild) }if (MagicZoom_ua == 'msie') {var f = document.createElement("IFRAME"); f.style.left = '0px'; f.style.top = '0px'; f.style.position = 'absolute'; f.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)'; f.style.width = this.bigImageCont.style.width; f.style.height = this.bigImageCont.style.height; f.frameBorder = 0;this.bigImageCont.appendChild(f) }var ar1 = document.createElement("DIV"); ar1.style.overflow = "hidden";this.bigImageCont.appendChild(ar1);this.bigImage = document.createElement("IMG");this.bigImage.src = bigimgsrc;this.bigImage.style.position = 'relative'; ar1.appendChild(this.bigImage) }; MagicZoom.prototype.initZoom = function() {if (this.loadingCont != null && !this.bigImage.complete && this.smallImage.width != 0 && this.smallImage.height != 0) {this.loadingCont.style.left = (parseInt(this.smallImage.width) / 2 - parseInt(this.loadingCont.offsetWidth) / 2) + 'px';this.loadingCont.style.top = (parseInt(this.smallImage.height) / 2 - parseInt(this.loadingCont.offsetHeight) / 2) + 'px';this.loadingCont.style.visibility = 'visible'}if (MagicZoom_ua == 'safari') {if (!this.safariOnLoadStarted) { MagicZoom_addEventListener(this.bigImage, "load", MagicZoom_createMethodReference(this, "initZoom"));this.safariOnLoadStarted = true;return} } else {if (!this.bigImage.complete || !this.smallImage.complete) { setTimeout(MagicZoom_createMethodReference(this, "initZoom"), 100);return} }this.bigImageSizeX = this.bigImage.width;this.bigImageSizeY = this.bigImage.height;this.smallImageSizeX = this.smallImage.width;this.smallImageSizeY = this.smallImage.height;if (this.bigImageSizeX == 0 || this.bigImageSizeY == 0 || this.smallImageSizeX == 0 || this.smallImageSizeY == 0) { setTimeout(MagicZoom_createMethodReference(this, "initZoom"), 100);return}if (this.loadingCont != null) this.loadingCont.style.visibility = 'hidden';this.smallImageCont.style.width = this.smallImage.width + 'px';this.bigImageCont.style.left = this.smallImage.width + 15 + 'px';this.bigImageCont.style.top = '0px';switch (this.settings['position']) {case 'left':this.bigImageCont.style.left = '-' + (15 + parseInt(this.bigImageCont.style.width)) + 'px';break;case 'bottom':this.bigImageCont.style.top = this.smallImage.height + 15 + 'px';this.bigImageCont.style.left = '0px';break;case 'top':this.bigImageCont.style.top = '-' + (15 + parseInt(this.bigImageCont.style.height)) + 'px';this.bigImageCont.style.left = '0px';break;case 'custom':this.bigImageCont.style.left = '0px';this.bigImageCont.style.top = '0px';break;case 'inner':this.bigImageCont.style.left = '0px';this.bigImageCont.style.top = '0px';break}this.bigImageContStyleLeft = this.bigImageCont.style.left;if (this.pup) {this.recalculatePopupDimensions();return}this.initBigContainer();this.initPopup(); MagicZoom_addEventListener(window.document, "mousemove", this.checkcoords_ref); MagicZoom_addEventListener(this.smallImageCont, "mousemove", MagicZoom_createMethodReference(this, "mousemove"));if (this.settings && this.settings["drag_mode"] == true) { MagicZoom_addEventListener(this.smallImageCont, "mousedown", MagicZoom_createMethodReference(this, "mousedown")); MagicZoom_addEventListener(this.smallImageCont, "mouseup", MagicZoom_createMethodReference(this, "mouseup"));this.positionX = this.smallImageSizeX / 2;this.positionY = this.smallImageSizeY / 2;this.showrect() } }; MagicZoom.prototype.replaceZoom = function(e, ael) {if (ael.href == this.bigImage.src) return;var newBigImage = document.createElement("IMG"); newBigImage.id = this.bigImage.id; newBigImage.src = ael.getElementsByTagName("img")[0].getAttribute("tsImgS");var p = this.bigImage.parentNode; p.replaceChild(newBigImage, this.bigImage);this.bigImage = newBigImage;this.bigImage.style.position = 'relative';this.smallImage.src = ael.getElementsByTagName("img")[0].src;this.safariOnLoadStarted = false;this.initZoom() }; function MagicZoom_findSelectors(id, zoom) {var aels = window.document.getElementsByTagName("li");for (var i = 0; i
ShopShow.css和MagicZoom.css:
/* Copyright 2008 MagicToolBox.com. To use this code on your own site, visit *//* CSS class for zoomed area */.MagicZoomBigImageCont { border:1px solid #91b817; background:#FFF; } .MagicZoomMain { text-align: center !important; width: 92px; } .MagicZoomMain div { padding: 0px !important; }/* Header look and feel CSS class *//* header is shown if "title" attribute is present in the <a> tag */.MagicZoomHeader { font: 10px Tahoma, Verdana, Arial, sans-serif; color: #fff; background: #91b817; text-align: center !important; }/* CSS class for small looking glass square under mouse */.MagicZoomPup { border: 0px solid #aaa; background: #ffffff; }/* CSS style for loading animation box */.MagicZoomLoading { text-align: center; background: #ffffff; color: #444; border: 1px solid #ccc; opacity: 0.8; padding: 3px 3px 3px 3px !important; display: none; /* do not edit this line please */}/* CSS style for gif image in the loading animation box */.MagicZoomLoading img { padding-top: 3px !important; }</a>
@charset "utf-8"; html,body,ul,li,p{margin:0px;padding:0px;} li{list-style:none;}/* tsShopContainer Download by */#tsShopContainer li,#tsShopContainer img{vertical-align:top;} #tsShopContainer{width:392px; height:495px; float:left; position:relative; } #tsShopContainer #tsImgS{text-align:center;width:100%;position:relative; border:1px solid #eaeaea; } #tsShopContainer #tsImgS a{display:block;text-align:center;margin:0px auto;} #tsShopContainer #tsImgS img{border:0px; width:390px; height:390px;} #tsShopContainer #tsPicContainer{width:100%;height:90px;position:relative;background:url(../images/scrollPicbg.gif) repeat-x 0px 0px; margin-top:10px; } #tsShopContainer #tsPicContainer #tsImgSArrL{width:15px;height:100%; background:url(../images/r_left.png) no-repeat left center; position:absolute;top:0px;left:0px;cursor:pointer;} #tsShopContainer #tsPicContainer #tsImgSArrR{width:15px;height:100%; background:url(../images/r_right.png) no-repeat right center; position:absolute;top:0px;right:0px;cursor:pointer;} #tsShopContainer #tsPicContainer #tsImgSCon{position:absolute;top:0px;left:18px;width:1px;height:90px;overflow:hidden; } #tsShopContainer #tsPicContainer #tsImgSCon ul{width:100%;overflow:hidden;} #tsShopContainer #tsPicContainer #tsImgSCon li{width:90px; float:left;cursor:pointer;} #tsShopContainer #tsPicContainer #tsImgSCon li img{padding:2px;margin:1px;border:1px solid #eaeaea; display:block;width:79px;height:79px;} #tsShopContainer #tsPicContainer #tsImgSCon li.tsSelectImg img{border:3px solid #ff4e00; padding:1px; margin:0px;}
我的重难点:
难点1: 在浏览中cookie的存取。 问题描述: 当用户浏览商品时将该用或浏览的当前商品id放入cookie中在”最近浏览“中显示用户浏览过的商品信息 难点:cookie中存放有SessionId如何区分SessionId和商品id? 解决方案: 在将商品id放入cookie中是将cookie的key值和value值设置为相同的值也就是商品的id(cookie中存放Sessionid的cookie的key值和value值不一样),然后在遍历cookie时对比其key值和value值是否相等(相等即商品id不相等则不是商品)
难点2: 百度富文本编辑器中图片上传的配置 问题描述: 使用百度的文本富文本编辑器是传图片后不能在页面上显示 解决方案: 在ueditor的jsp文件夹下的config.json文件中配置正确的上传路径和访问访问路径。 imagePathFormat:图片上传后保存的路径相对于网站的根目录 imageUrlPrefix:图片的访问路径前缀相对于当前页面路径,其访问路径为imagerurlPrefix+imagePathFormat
难点3: 商品分类信息的层级显示: 问题描述: 商品分类中存在父级分类和子分类。如何显示 解决方案: 分别查询出父级分类和子级分类类在遍历父级分类时遍历子级分类找出该父级分类的子分类进行显示 复制代码如下:
商品分类
难点4:
使用过滤器实现权限控制 问题描述: 如何区分哪些页面需要验证权限 解决方案: 将需要验证权限的页面设置统一格式的路径在Filter中使用正则表达式筛选出取药进行权限验证的页面进行权限验证,
自在人与人
以上がYimai.com プロジェクトのサンプル チュートリアルを共有するの詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

javadevelopmentisnotentirelylylypratform-IndopentDuetoseveralfactors.1)jvmvariationsaffectperformanceandbehavioracrossdifferentos.2)nativeLibrariesviajniintroducePlatform-specificissues.3)giaiasystemsdifferbeTioneplateplatifflics.4)

Javaコードは、さまざまなプラットフォームで実行するときにパフォーマンスの違いがあります。 1)JVMの実装と最適化戦略は、OracleJDKやOpenJDKなどとは異なります。 2)メモリ管理やスレッドスケジューリングなどのオペレーティングシステムの特性もパフォーマンスに影響します。 3)適切なJVMを選択し、JVMパラメーターとコード最適化を調整することにより、パフォーマンスを改善できます。

java'splatformindepentedencehaslimitationsincludingporformanceoverhead、versioncompatibulisisues、changleSwithnativeLibraryIntegration、プラットフォーム固有の機能、およびjvminStallation/maintenation。

PlatformEndependEncealLowsProgramStorunonAnyPlatformWithOdification、whilecross-platformdevelopmentReadreessomeplatform-specificAdjustments.platformindependence、explifiedByjava、unableSiversAlexecutionButMayCompromperformance

jitcompalilationinjavaenhancesperformance whelemaintaining formindepence.1)itdynamicallyTrantesiNTODENATIVEMACHINECODEATRUNTIME、最適化されたコードを最適化すること、

javaispopularforsoss-platformdesktopapplicationsduetoits "writeonce、runaynay" philosophy.1)itusesbytecodatiTatrunnanyjvm-adipplatform.2)ライブラリリケンディンガンドジャヴァフククレアティック - ルルクリス

Javaでプラットフォーム固有のコードを作成する理由には、特定のオペレーティングシステム機能へのアクセス、特定のハードウェアとの対話、パフォーマンスの最適化が含まれます。 1)JNAまたはJNIを使用して、Windowsレジストリにアクセスします。 2)JNIを介してLinux固有のハードウェアドライバーと対話します。 3)金属を使用して、JNIを介してMacOSのゲームパフォーマンスを最適化します。それにもかかわらず、プラットフォーム固有のコードを書くことは、コードの移植性に影響を与え、複雑さを高め、パフォーマンスのオーバーヘッドとセキュリティのリスクをもたらす可能性があります。

Javaは、クラウドネイティブアプリケーション、マルチプラットフォームの展開、および言語間の相互運用性を通じて、プラットフォームの独立性をさらに強化します。 1)クラウドネイティブアプリケーションは、GraalvmとQuarkusを使用してスタートアップ速度を向上させます。 2)Javaは、埋め込みデバイス、モバイルデバイス、量子コンピューターに拡張されます。 3)Graalvmを通じて、JavaはPythonやJavaScriptなどの言語とシームレスに統合して、言語間の相互運用性を高めます。


ホットAIツール

Undresser.AI Undress
リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

Video Face Swap
完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

人気の記事

ホットツール

SublimeText3 Mac版
神レベルのコード編集ソフト(SublimeText3)

MinGW - Minimalist GNU for Windows
このプロジェクトは osdn.net/projects/mingw に移行中です。引き続きそこでフォローしていただけます。 MinGW: GNU Compiler Collection (GCC) のネイティブ Windows ポートであり、ネイティブ Windows アプリケーションを構築するための自由に配布可能なインポート ライブラリとヘッダー ファイルであり、C99 機能をサポートする MSVC ランタイムの拡張機能が含まれています。すべての MinGW ソフトウェアは 64 ビット Windows プラットフォームで実行できます。

PhpStorm Mac バージョン
最新(2018.2.1)のプロフェッショナル向けPHP統合開発ツール

SublimeText3 中国語版
中国語版、とても使いやすい

メモ帳++7.3.1
使いやすく無料のコードエディター

ホットトピック









