<html>
<body>
<form >
<table align="center">
<logic:notPresent name="loginFormBean">
<tr>
<td colspan="2">
用户名:
</td>
</tr>
<tr>
<td>
<input type="text" name="uname" size=10 " class="editbox">
</td>
<td>
<div id="msg"></div>
</td>
</tr>
<tr>
<td colspan="2">
密 码:
</td>
</tr>
<tr>
<td>
<input type="password" name="upass" size=10 " class='editbox'>
</td>
<td>
<FONT color="red"> <html:errors property="wrongpass" /> </FONT>
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="登陆" class='btn'
<input type="reset" value="重置" class='btn'>
</td>
</tr>
<tr>
<td>
<a href="reg.htm">注册用户</a>
</td>
</tr>
</logic:notPresent>
<logic:present name="loginFormBean">
<tr>
<td width=''>
<font color='red'>当前用户:<strong> ${sessionScope.username }</strong></font>
</td>
</tr>
<tr>
<td width='150'>
<a href="my.htm">管理我的租房信息</a>
</td>
</tr>
<tr>
<td width='100'>
<a href="post.htm">发布租房信息</a>
</td>
</tr>
<tr>
<td width='100'>
<a href="login.htm">返回首页</a>
</td>
</tr>
<tr>
<td width='100'>
<a href="index.htm">[注销]</a>
</td>
</tr>
</logic:present>
</table>
</form>
</body>
</html>
我用的是struts判断用户是否已经登陆,我现在的需求是:如果用户登陆了,就显示<logic:present>标签下的东西,如果没有登陆就显示<logic:notpresent>标签下的登陆框。