Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如果存在变量,则使用JSTL显示(或不显示)DIV或其他HTML标记_Html_Maven_Jsp_Spring Boot_Jstl - Fatal编程技术网

如果存在变量,则使用JSTL显示(或不显示)DIV或其他HTML标记

如果存在变量,则使用JSTL显示(或不显示)DIV或其他HTML标记,html,maven,jsp,spring-boot,jstl,Html,Maven,Jsp,Spring Boot,Jstl,我在自学如何与JSTL合作 当控制器将变量设置为“非”时,我在视图上显示/不显示DIV时遇到问题 我正在从事一个SpringBootMaven项目,该项目使用Tiles进行模板管理 我在控制器中很好地设置了变量,在JSP视图中也可以看到它,在本例中,在我的DIV中显示它,如下所示: <c:if test="${!empty loggeduser}"> <div class="alert alert-success alert-dismissible" role="ale

我在自学如何与JSTL合作

当控制器将变量设置为“非”时,我在视图上显示/不显示DIV时遇到问题

我正在从事一个SpringBootMaven项目,该项目使用Tiles进行模板管理

我在控制器中很好地设置了变量,在JSP视图中也可以看到它,在本例中,在我的DIV中显示它,如下所示:

<c:if test="${!empty loggeduser}">
    <div class="alert alert-success alert-dismissible" role="alert">
        <button type="button" class="close" data-dismiss="alert"
            aria-label="Close">
            <span aria-hidden="true">&times;</span>
        </button>
        <strong>${loggeduser.email}</strong> Welcome to the new project!
    </div>
</c:if>

我正在使用Tiles进行模板管理。这里的问题是JSP行
没有包含在cascade中

我解决了我的问题,包括我必须使用JSTL EL的每个视图文件上的JSP行。

请尝试使用test=“${not empty loggeduser.email}”相同的结果
test=“${not empty loggeduser.email}
test=“${!empty loggeduser.email}
显示与原始的
test=“${!empty loggeduser}
相同。即,图像编号2。我觉得这不需要太多工作,让我发疯。
@PostMapping("/login/entry")
public String checkUserInfo(@Valid LoginUser loginUser, BindingResult bind, Model model) {
    logger.info("Entry");
    if (bind.hasErrors()) {
        logger.info("Bind has errors");
        model.addAttribute("hideTemplates", true);
        return "loginpage";
    }
    model.addAttribute("loggeduser", loginUser);
    return "aboutpage";
}