首页 > 解决方案 > 在我的脚本块上获取无法访问的代码

问题描述

正文中脚本块开头的“如果”在 Intellij 中一直被识别为无法访问。我不知道为什么。有任何想法吗?

代码截图

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head><%@ page isELIgnored="false" %>
    <meta charset="ISO-8859-1">
    <style>
        <%@include file="/css/success.css" %>
    </style>
</head>
<Title>Logged In Successfully</Title>
<body>
<div class="message">
    <h2>${login.message}</h2>
</div>
    <script>
            if(${AdminCheck.adminCheck}  === true){
                document.write("<form action=\"http://example.com:8080/table\">" +
                    "<input class=\"showTable\" type=\"submit\" value=\"View Users\"/>" +
                    "</form>");
            }else{
                document.write("<form>\n" +
                    "\t<input class=\"adminVerification\" type=\"text\" id=\"verify\" name=\"adminVerification\" placeholder=\"Password\"/>\n" +
                "</form>");

                var check = document.getElementsByName("adminVerification");
                if(check.value === "IamADMIN"){
                    document.write("<form action=\"http://example.com:8080/table\">" +
                        "<input class=\"showTable\" type=\"submit\" value=\"View Users\"/>" +
                        "</form>");
                    document.getElementsByName("adminVerification").style.display="none";
                }
            }
    </script>
</body>
</html>

更新:原来脚本正在运行,我将一些条件值更改为多余的真或假,它们可以正常工作。IntelliJ 仍然进行了一些奇怪的分析,说它无法访问。不知道为什么它会抛出那个。

标签: javascripthtmljsp

解决方案


但它是否运行并且 IntelliJ 错误地将其识别为无法访问?或者它实际上是无法到达的?

此外,标题标签位于头部和主体之外,这可能会使 IntelliJ 感到困惑


推荐阅读