Spring MVC jsp c:如果标签不起作用

时间:2015-12-27 12:31:39

标签: java spring jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE html>
<html>
<head>    
<!-- jQuery -->
<script
    src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>    
</head>
<body>

        <c:if test="${error}">
            <script>
                alert("You must have something...");
            </script>
        </c:if>



</body>
</html>

jsp文件有

<c:if test="${error}">
    <script>
        alert("You must have something...");
    </script>
</c:if>

弹簧控制器

@RequestMapping(value = "/sample/board.do", method = RequestMethod.POST)
public ModelAndView updateBoard(@ModelAttribute HistoryBoard historyBoard) throws Exception {
    ModelAndView mv = new ModelAndView("redirect");

    mv.addObject("error", true);

    return mv;
}

并制作网址http://localhost:8080/test/board/board.do?error=true

c:if代码无效

<c:if test="${not empty error}">
    <h1>TEST</h1>
</c:if>

c:if不空也不起作用。

如何修复此标记?

1 个答案:

答案 0 :(得分:1)

错误是参数,而不是范围变量。

If GetKeyState("LAlt") & GetKeyState("RAlt")
    send {Shift Down}
else
    send {Shift Up}