[英]hide div tag in jsp page
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Welcome</title>
<script type="text/javascript">
$(document).ready(function()
{
if()==null)
{
}
}
);
</script>
</head>
<center>
<%@ include file="Head.jsp" %>
</center>
<body>
<div id="tempDiv">
<h1>Message : ${message}</h1>
<h1>Author : ${author}</h1>
</div>
<a href='<c:url value="/j_spring_security_logout" />' > Logout</a>
<div align="center">
<table class="table1">
<tr>
<td align="center" width="800" height="400"><font size="10">
Welcome </font></td>
</tr>
</table>
</div>
</body>
</html>
$ message值不存在時如何隱藏div標簽。 我想隱藏我的div標簽。 在jsp頁面。 當用戶單擊主頁時。 我在這里嘗試了javascript代碼,但沒有獲得如何在javascript中使用jsp元素的任何答案。 或在我的情況下隱藏div標簽有用的任何代碼都建議使用。 感謝你....
嘗試這個
<c:if test="${empty message}">
</c:if>
<c:if test="${not empty message}">
<div id="tempDiv">
<h1>Message : ${message}</h1>
<h1>Author : ${author}</h1>
</div>
</c:if>
您需要檢查變量是否為空,並取決於html頁上的打印內容...希望它能工作
或另一種方式
<c:choose>
<c:when test="${empty message}">
</c:when>
<c:otherwise>
<div id="tempDiv">
<h1>Message : ${message}</h1>
<h1>Author : ${author}</h1>
</div>
</c:otherwise>
</c:choose>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.