我与bug不共戴天 2020-10-20 19:59 采纳率: 0%
浏览 276

前台jsp页面无法跳转到controller层(确定没有走到controller)求助(jsp没有进入js)

20-Oct-2020 19:51:45.237 淇℃伅 [http-nio-8083-exec-1] org.springframework.web.servlet.FrameworkServlet.initServletBean Initializing Servlet 'dispatcherServlet'
20-Oct-2020 19:51:46.030 淇℃伅 [http-nio-8083-exec-1] org.springframework.web.servlet.FrameworkServlet.initServletBean Completed initialization in 793 ms
20-Oct-2020 19:51:46.164 淇℃伅 [http-nio-8083-exec-1] com.alibaba.druid.support.logging.JakartaCommonsLoggingImpl.info {dataSource-1} inited
20-Oct-2020 19:51:50.640 淇℃伅 [Catalina-utility-1] org.apache.catalina.startup.HostConfig.deployDirectory 鎶妛eb 搴旂敤绋嬪簭閮ㄧ讲鍒扮洰褰� [D:\study\software\websoftware\apache-tomcat-9.0.33\webapps\manager]
20-Oct-2020 19:51:50.669 淇℃伅 [Catalina-utility-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\study\software\websoftware\apache-tomcat-9.0.33\webapps\manager] has finished in [30] ms

jsp代码

<div class="mask hidden" id="login">
    <div class="mask_content">
        <div class="mask_content_header">
            <img src="${pageContext.request.contextPath}/img/logo.png" alt="" class="ma">
        </div>
        <div class="mask_content_body">
           <form id="loginForm" action="#">
                <h3>快速登录</h3>
                <input type="email" id="loginEmail" placeholder="请输入邮箱" name="email">
                <input type="password" id="loginPassword" placeholder="请输入密码" name="password">
                <div id="forget">
                    <a href="${pageContext.request.contextPath}/user/forgetPassword">忘记密码?</a>
                </div>
                <input type="submit" onclick="return commitLogin()" value="登&#x3000;录">
            </form>
        </div>
        <div class="mask_content_footer">
            <span id="login_close">关&#x3000;闭</span>
        </div>
    </div>
</div>

js代码

function getRootPath() {
    var pathname = window.location.pathname.substring(1);
    var end = pathname.indexOf('/');
    pathname = pathname.substring(0, end);
    return pathname;
}

function commitLogin() {
    var email = $("#loginEmail").val();
    alert(email)
    var password = $("#loginPassword").val();
    alert(password)
    if (null != email && email != "" && null != password && password != "") {
        var params = $("#loginForm").serialize();
        // alert(params);
        // post要小写

        $.post('/' + getRootPath() + "/user/loginUser", params, function (data) {
            // alert(data);
            if (data == 'success') {

                //登录框消失
                $("#login").addClass("hidden");

                $("#account").text($("#loginEmail").val());
                //将注册的user信息展示
                $("#regBlock").css("display", "none");
                $("#userBlock").css("display", "block");

                $("#isLogin").val(1);
            }
        });

        return false;
    }

    return false;
}
  • 写回答

1条回答 默认 最新

  • 星辰海 2023-04-14 15:41
    关注

    来来来,做这么几步操作。
    1、按F12,先打开console,刷新页面,看控制台是否有报错;
    2、如果没有报错,按登录按钮,看看有没有向对应的地址发送请求;
    3、看响应码,如果是404那就是地址错误。

    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题