后台代码
@At
@POST
@Ok("jsp:jsp.register")
public void register(@Param("username") String username, @Param("password") String password, HttpSession session) {
User user = userService.addUser(username, password);
if (user != null) {
session.setAttribute("user", user);
}
System.out.println(session.getAttribute("user"));
}
前台jstl
<c:choose>
<c:when test="${!empty session.user}">
<c:out value="${session.user.username}"></c:out>
</c:when>
<c:otherwise>
<form action="${base}/user/register" method="post">
<input type="text" name="username"> <input type="password"
name="password"> <input type="submit" value="register">
</form>
</c:otherwise>
</c:choose>
debug后台session有值了,但是走不到${!empty session.user},是jstl错了吗?还有${obj}是指代的什么???