为什么我会收到错误(?)?

时间:2018-03-12 03:13:21

标签: jsp

我输入此代码。

<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
    <div id="wrapper">
        <div id="left">
            <h1>Lorem ipsum</h1>
            <h2>Lorem ipsum</h2>
            <div id="leftbottom"></div>
        </div>
        <div id="right">
            <h1>Content ipsum</h1>
            <h2>Lorem ipsum</h2>
            <h2>Lorem ipsum</h2>
            <h2>White space</h2>
        </div>
    </div>
</body>
</html>

但是,结果在上面。

<%
    int a = 5, b = 10;
    boolean what; 
    boolean c = true, d = false;

    out.print("a :" + a + " b :" + b + "<P>");
    out.print("a<b :" + (a > b) + "<P>");

    out.print("a<=b :" + (a <= b) + "<P>");
    out.print("a==b :" + (a == b) + "<P>");
    out.print("a>b :" + (a > b) + "<P>");
    out.print("a>=b :" + (a >= b) + "<P>");
    out.print("c :" + c + "d :" + d + "<P>");
    out.print("c&&d :" + (c && d) + "<P>");
    out.print("c||d :" + (c || d) + "<P>");
    what = a > b ? true : false;
    out.print("a>b? " + what + ", !(a>b)=" + !what);
%>

a :5 b :10 aa<=b :true a==b :false a>b :false a>=b :false c :trued :false c&&d :false c||d :true a>b? false, !(a>b)=true 代码在哪里? 我没有输入(a<b)。但是,句子是大胆的。

1 个答案:

答案 0 :(得分:0)

您可能希望使用&lt;代替<&gt;代替>

a<b应为a&lt;b

您已获得大胆,因为html被解释为代表<b>的{​​{1}}代码。