我想在"我的个人资料"中显示来自数据库的用户详细信息。模态。我在login.jsp页面中使用JSTL。这是我尝试过的(和其他一些变化)没有任何结果。数据库连接正常!表名是users
,我想在表中找到合适的用户。当有效用户登录时,我从username
收到index.jsp
请求。
<c:forEach var="user" items="${users.rows}" >
<c:if test="${username}" == "${user.username}"> // <-- This is NOT working!
如果username
和${user.username}
匹配,那么我想在模式中显示用户的信息,如:
<c:out value="${user.fullName}"/>
<c:out value="${user.occupation}"/>
<c:out value="${user.email}"/>
<fmt:formatDate type="both" dateStyle="short" timeStyle="short" value="${user.joined}"/>
答案 0 :(得分:0)
我正在寻找的答案是<c:if test="${username eq user.username}">
现在工作正常。我希望它也可以帮助其他人:)