欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

struts與datagrid顯示數(shù)據(jù)

一、創(chuàng)建Web工程
    工程名稱:sajdemo
二、添加jar包支持
    --struts-2.8.7.jar
    commons-fileupload-1.2.2.jar
    commons-io-2.0.1.jar
    commons-lang3-3.1.jar
    freemarker-2.3.19.jar
    struts2-core-2.3.7.jar
    ognl-3.0.5.jar
    xwork-core-2.3.7.jar
    javassist-3.11.0.GA.jar
    --json.jar    
    json-lib-2.3-jdk15.jar
    struts2-json-plugin-2.3.7.jar
    commons-lang-2.4.jar
    ezmorph-1.0.6.jar
    commons-beanutils-1.8.0.jar
三、添加配置文件與修改web.xml文件
    web.xml配置
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
        http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
        <filter>
            <filter-name>struts2</filter-name>
            <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
        </filter>
        <filter-mapping>
            <filter-name>struts2</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>
        <welcome-file-list>
            <welcome-file>index.jsp</welcome-file>
        </welcome-file-list>
    </web-app>
    struts.xml配置
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
        "http://struts.apache.org/dtds/struts-2.3.dtd">
    
    <struts>
        <constant name="struts.devMode" value="true" />
        <package name="data" namespace="/" extends="json-default">
            <action name="orderItemAction_*" class="cn.jbit.sajdemo.web.action.OrderItemAction" method="{1}">
                <result name="success" type="json">
                    <param name="root">result</param>
                </result>
            </action>
        </package>
    </struts>
四、創(chuàng)建Action與javabean
    1.在src下創(chuàng)建包
        包名:cn.jbit.sajdemo.domain
        包名:cn.jbit.sajdemo.web.action
    2.在包下創(chuàng)建Action與javabean
        javabean:
        public class Product {
            private String productId;
            private String productName;
            private Double productPrice;
            //省略get and set
        }
        
        public class OrderItem {
            private String itemId;
            private Integer count;
            private Product product;
            //省略get and set
        }
        
        public class OrderItemAction extends ActionSupport {
            private JSONObject result;
            public String list(){
                //創(chuàng)建產(chǎn)品
                Product p1 = new Product();
                p1.setProductId("p123");
                p1.setProductName("蘋果手機(jī)");
                p1.setProductPrice(3000d);
                
                Product p2 = new Product();
                p2.setProductId("p124");
                p2.setProductName("三星手機(jī)");
                p2.setProductPrice(3000d);
                //創(chuàng)建訂單項(xiàng)
                OrderItem oi1 = new OrderItem();
                oi1.setCount(10);
                oi1.setItemId("o123");
                oi1.setProduct(p1);
                
                OrderItem oi2 = new OrderItem();
                oi2.setCount(20);
                oi2.setItemId("o124");
                oi2.setProduct(p2);
                
                
                //創(chuàng)建集合并添加訂單項(xiàng)
                List<OrderItem> orderItems = new ArrayList<OrderItem>();
                orderItems.add(oi1);
                orderItems.add(oi2);
                
                
                //將集合添加到Map中
                Map<String,Object> map = new HashMap<String, Object>();
                map.put("rows", orderItems);
                
                
                //將Map轉(zhuǎn)換為Json格式
                result = JSONObject.fromObject(map);
                
                //輸出Json后的格式數(shù)據(jù)
                System.out.println(result);
                return SUCCESS;
            }
            //省略get and set
        }
五、添加EasyUI支持
    jquery-easyui-1.3.2
六、視圖
    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <base href="<%=basePath%>">
        <title>My JSP 'index.jsp' starting page</title>
        <meta http-equiv="pragma" content="no-cache">
        <meta http-equiv="cache-control" content="no-cache">
        <meta http-equiv="expires" content="0">    
        <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
        <meta http-equiv="description" content="This is my page">
          <link rel="stylesheet" href="jquery-easyui-1.3.2/themes/default/easyui.css" type="text/css"></link>
         <link rel="stylesheet" href="jquery-easyui-1.3.2/themes/icon.css" type="text/css"></link>
         <script type="text/javascript" src="jquery-easyui-1.3.2/jquery-1.8.0.min.js"></script>
         <script type="text/javascript" src="jquery-easyui-1.3.2/jquery.easyui.min.js"></script>  
     </head>
      <body>
        <table id="dg"></table>  
      </body>
      <script type="text/javascript">
          $('#dg').datagrid({    
            url:'orderItemAction_list.action',    
            columns:[[    
                {field:'count',title:'商品數(shù)量',width:100},    
                {field:'itemId',title:'訂單項(xiàng)編號(hào)',width:100},    
                {field:'product',title:'商品名稱',formatter:function(value){
                    return value.productId;
                },width:100}    
            ]]    
        });
      </script>
    </html>
    struts與datagrid顯示數(shù)據(jù)

站在用戶的角度思考問題,與客戶深入溝通,找到休寧縣網(wǎng)站設(shè)計(jì)與休寧縣網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗(yàn),讓設(shè)計(jì)與互聯(lián)網(wǎng)技術(shù)結(jié)合,創(chuàng)造個(gè)性化、用戶體驗(yàn)好的作品,建站類型包括:成都網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣、國際域名空間、網(wǎng)頁空間、企業(yè)郵箱。業(yè)務(wù)覆蓋休寧縣地區(qū)。

當(dāng)前名稱:struts與datagrid顯示數(shù)據(jù)
分享鏈接:http://aaarwkj.com/article44/peggee.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站營銷、外貿(mào)建站、域名注冊(cè)做網(wǎng)站、關(guān)鍵詞優(yōu)化、自適應(yīng)網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

h5響應(yīng)式網(wǎng)站建設(shè)
国产爆操美女在线观看| 熟女中文字幕一区二区| 日本免费一区二区三个| 日本 午夜 在线 视频| 亚洲国产精品午夜福利在线播放| 农村女人91熟女熟妇| 精品国产欧美成人一区| 欧美熟妇精品一级视频| 日本不卡一二区不久精品免费| 日韩亚洲国产激情一区二区| 久久精品亚洲毛片美女极品| 久久香蕉精品国产亚洲av| 91桃色午夜福利视频| 国产欧美日韩91成人| 成人性生活毛片免费视频| 欧美高清一区二区三区不卡| 91福利社区欧美大片| 国产精品一区二区三区激情| 亚洲一区二区三区四区国产| 日本一级黄色影视大全| 欧美夫妻香蕉视频网站| 91美女黑丝免费国产视频| 婷婷久久香蕉毛片毛片| 日本人妻在线一区二区三区| 东京热加勒比在线播放| 欧美成人精品三级在线网站| 亚洲欧洲日产国码一区| 国产91久久精品一区二区| 日本一二三四卡久久精品| 99热视频这里只有精品| 中文字幕亚洲精品99| 亚洲图文一区二区三区四区| 一级黄片电影中文字幕| 亚洲 欧美 日韩一区| 色综合色综合色综合色综合| 成人爱爱免费观看视频| 91精品国产综合久蜜臂| 丰满人妻一区二三区av| 欧美精品一区二区久久不卡| 日韩精品在线观看你懂的| 未满十八禁止免费在线观看|