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>
    

      

  • 相关阅读:
    线程池、进程池(concurrent.futures模块)和协程
    python中socket、进程、线程、协程、池的创建方式和应用场景
    IO多路复用和local概念
    pymysql模块
    HTML初识
    CSS之选择器
    CSS之样式属性(背景固定、圆形头像、模态框)
    字符串格式的方法%s、format和python3.6新特性f-string和类型注解
    common-pool2 使用
    apache-common pool的使用
  • 原文地址:https://www.cnblogs.com/liuzhiw/p/7771685.html
Copyright © 2011-2022 走看看