<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%--
Date: 11/28/18 : 10:55 AM
--%>
<%@ page import="cc.openhome.model.UserService" %>
<%@ page import="java.text.DateFormat" %>
<%@ page import="java.util.Locale" %>
<%@ page import="java.util.List" %>
<%@ page import="cc.openhome.model.Blah" %>
<%
/*String username = (String) request.getSession().getAttribute("login");
Blah blah = new Blah();
blah.setUsername(username);*/
%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
<title></title>
<link rel="stylesheet" href="css/member.css" type="text/css">
</head>
<body>
<div class="leftPanel">
<img src="img/mi.png" alt="" width="120" height="100"/>
<br><br>
<a href="logout.do?username="${sessionScope.login}"">
${sessionScope.login}
</a>
</div>
<form method="post" action="message.do">
...<br>
<c:if test="${requestScope.blabla != null}">
140
</c:if>
<%-- <%
String blabla = (String) request.getAttribute("blabla");
if(blabla != null){
%>
140<br>
<%
}
%>--%>
<textarea cols="60" rows="4" name="blabla">
${ requestScope.blabla }</textarea><br>
<button type="submit"></button>
</form>
<table style="text-align: left;width: 510px; height: 80px;"
border="0" cellpadding="2" cellspacing="2">
<thead>
<tr>
<th><hr></th>
</tr>
</thead>
<tbody>
<%
/*
DateFormat dateFormat = DateFormat.getDateTimeInstance(
DateFormat.FULL,DateFormat.FULL,Locale.CHINA);
*/
/*
UserService userService = (UserService) application.getAttribute("userService");
List<Blah> blahs = userService.getBlahs(blah);
*/
//List<Blah> blahs = "${requestScope.blahs}";
%>
<c:forEach var="blah" items="${requestScope.blahs}">
<tr>
<td style="vertical-align: top">${blah.username}<br>
<c:out value="${blah.txt}"/><br>
<fmt:formatDate value="${blah.date}" type="both"
dateStyle="full" timeStyle="full"/>
<a href="delete.do?message=${blah.date.time}"></a>
<hr>
</td>
</tr>
</c:forEach>
</tbody>
</table>
<hr style="width: 100px; height: 1px">
</body>
</html>
![][1]
the message will not be displayed until the submit button on the front page is executed.
< c:forEach var= "blah" items= "${requestScope.blahs}" > appears after submission. It is expected to request the existing information first, display it on the page, add new information, submit and refresh, and all the information appears. After debug, it is found that it does not enter < c:foreach >, and only after the submit is submitted will it be displayed