第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

spring框架下ajax的url地址如何定位到spring對(duì)應(yīng)的類

標(biāo)簽:
Java JQuery

通过html页面的点击事件执行ajax方法,定位到springboot的对应java类的对应方法中;

HTML代码部分

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <script th:substituteby="merchant/fragments/head::header"/>

    <!-- 组件 -->
    <link rel="stylesheet"
          />

</head>
<body ontouchstart="">

<div class="am-flexbox" style="text-align:center">
    <div class="am-flexbox-item">
        欢迎使用XXXXX平台
        <br/>
        请输入以下信息完成验证
    </div>
</div>

<form class="am-list am-list-form">
    <div class="am-list-body">
        <div th:substituteby="merchant/fragments/head::input('alipayAccount','XXX账号','请输入','text',null,false)"/>
        <div th:substituteby="merchant/fragments/head::input('principalPerson','XXX姓名','请输入','text',null,false)"/>
        <div th:substituteby="merchant/fragments/head::input('principalMobile','XXX手机','请输入','text',null,false)"/>
        <div th:substituteby="merchant/fragments/head::input('certNo','XXX身份证号','请输入','text',null,false)"/>
    </div>
    <button type="button" class="am-button" **onclick="confirmID()"** style="background-color:rgba(63, 164, 237, 1);position:fixed;bottom: 0px;width: 100%;">确认</button>

    <script >
        function confirmID(){
            ap.showLoading({
                content: '执行中'
            });
            var form=$('.am-list-form').serializeArray();
            console.log(form);
            AJAX({
                type:'POST',
                url:'/rest/merchant/validate.json',
                data:form,
                dataType:'json',
                success: function(data){
                    if (data.status != 'OK') {
                        alert("验证失败,请检查输入项");
                        ap.hideLoading();
                        return;
                    }
                    $("#dialog [name='content']").html('验证成功');
                    ap.hideLoading();
                    window.location.href='/merchant/signStepOne';
                },
                error: function(e){
                    ap.hideLoading();
                    console.log(e);
                    $("#dialog [name='content']").html(e.responseJSON.message);
                    $('#dialog').show();
                }
            });
        }
    </script>
</form>
</body>
</html>

后台springboot框架的代码部分;


package com.controller;

@RestController//标注此类是一个控制器类
@RequestMapping("/rest/merchant")//RequestMapping是一个用来处理请求地址映射的注解,可用于类或方法上。用于类上,表示类中的所有响应请求的方法都是以该地址作为父路径
public class MerchantH5RestController extends BaseController {
    private static final Logger logger = LoggerFactory.getLogger(MerchantH5RestController.class);

    @Value("${qrcode.storeManage}")//在spring 3.0中,可以通过使用@value,对一些如xxx.properties文件中的文件,进行键值对的注入
    private String              qrcodeStoreManage;

    @RequestMapping(value = "/validate.json", method = { RequestMethod.POST, RequestMethod.GET })
    public HttpResult validate(HttpServletRequest request, HttpServletResponse response,@RequestParam String alipayAccount) {
        //url会根据@RequestMapping先匹配到class类上的字符串,然后再匹配到方法上的字符串,会进入到这个方法中继续执行
        //代码片段
    }

}
點(diǎn)擊查看更多內(nèi)容
TA 點(diǎn)贊

若覺(jué)得本文不錯(cuò),就分享一下吧!

評(píng)論

作者其他優(yōu)質(zhì)文章

正在加載中
  • 推薦
  • 評(píng)論
  • 收藏
  • 共同學(xué)習(xí),寫下你的評(píng)論
感謝您的支持,我會(huì)繼續(xù)努力的~
掃碼打賞,你說(shuō)多少就多少
贊賞金額會(huì)直接到老師賬戶
支付方式
打開(kāi)微信掃一掃,即可進(jìn)行掃碼打賞哦
今天注冊(cè)有機(jī)會(huì)得

100積分直接送

付費(fèi)專欄免費(fèi)學(xué)

大額優(yōu)惠券免費(fèi)領(lǐng)

立即參與 放棄機(jī)會(huì)
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)

舉報(bào)

0/150
提交
取消