zoukankan      html  css  js  c++  java
  • 处理器返回值Object的使用

    例子:

    引入Maven依赖

    <!--firstjson-->
            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>fastjson</artifactId>
                <version>1.2.7</version>
            </dependency>
            <!--httpManagerConverter转换器-->
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>2.6.3</version>
            </dependency>
    <!--jstl-->
            <dependency>
                <groupId>jstl</groupId>
                <artifactId>jstl</artifactId>
                <version>1.2</version>
            </dependency>

    大配置下面

    解决静态资源和大配置:

    控制器:

     @RequestMapping("/map")
        @ResponseBody
        public Object doMap(){
            Map<String,String> map=new HashMap<String, String>();
            map.put("威哥","无敌");
            return map;
        }

    页面:

    <%--
      Created by IntelliJ IDEA.
      User: Administrator
      Date: 2017/10/29
      Time: 16:08
      To change this template use File | Settings | File Templates.
    --%>
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <html>
    <head>
        <title>frist</title>
        <script type="text/javascript" src="js/jQuery1.11.1.js"></script>
        <script type="text/javascript">
            $(function(){
                $("#mag").click(function(){
                    $.ajax({
                        url:'/create',
                        type:"POST",
                        success:function(data){
                            $.each(data,function(i,dom){
                                alert(dom.name)
                            })
                        }
                    })
    
    
                })
            })
        </script>
        <script type="text/javascript">
            $(function(){
                $("#map").click(function(){
                    $.ajax({
                        url:'/map',
                        type:"POST",
                        success:function(data){
                            $.each(data,function(i,dom){
                                alert(data[i])
                            })
                        }
                    })
    
                })
            })
        </script>
    </head>
    <body>
    <input type="button" value="点我" id="mag">
    <input type="button" value="点我哦" id="map">
    </body>
    </html>
    

      

  • 相关阅读:
    24. Swap Nodes in Pairs(M);25. Reverse Nodes in k-Group(H)
    61. Rotate List(M);19. Remove Nth Node From End of List(M)
    素数筛选法(prime seive)
    哈夫曼树;二叉树;二叉排序树(BST)
    sort与qsort的区别与联系
    贪心算法
    First non-repeating character in a stream
    transform
    C++11 & C++14 & C++17新特性
    开个玩笑
  • 原文地址:https://www.cnblogs.com/liuzhiw/p/7771685.html
Copyright © 2011-2022 走看看