⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 userlist.jsp

📁 这是《Struts网络编程实例》一书zhogn 的源代码部分
💻 JSP
字号:
<%@ include file="/jsp/common/environment.jsp" %>
<!-- tiles模版,以一个table开始-->
<table border="0" width="100%">
<tr>
<td>
<!-- 检验是否存在userlist对象,这个对象名跟相对应的action里面的httpServletRequest.setAttribute("userlist",userInfoList);相对应-->
<logic:notPresent name="userlist" >
<p align="center" class="help"><bean:message key="usermgr.list.empty"/></p>
</logic:notPresent>
<logic:present name="userlist" >
<table class="body2" cellspacing="1" align="center">
	<!-- 显示标题栏-->
    <tr>      
    <td class="centerunbold1" width="5%"><bean:message key="userinfo.Id"/></td>
    <td class="centerunbold1" width="17%"><bean:message key="userinfo.userLoginId"/></td>
    <td class="centerunbold1" width="17%"><bean:message key="userinfo.name"/></td>    
    <td class="centerunbold1" width="6%"><bean:message key="userinfo.gender"/></td>
    <td class="centerunbold1" width="30%"><bean:message key="userinfo.email"/></td> 

   
    <td class="centerunbold1" width="15%"><bean:message key="userinfo.officePhone"/></td>  

  
    <td class="centerunbold1" width="10%"><bean:message key="userlist.operation"/></td>
     
    </tr> 
    <%
    int i=0;
    %>
    <!-- 循环显示用户列表-->
   <logic:iterate name="userlist"  id="userinfo" 

type="org.ithinking.strutsExample.entity.Userinfo">

    <tr>
    <td class="td2"><%=i++%></td>
    <td class="td2"><bean:write name="userinfo" property="userloginid"/></td>
    <td class="td2"><bean:write name="userinfo" property="username"/></td>
    <td class="td2">
     <logic:equal name="userinfo" property="sex" value="F">
           <bean:message key="userinfo.female"/>
    </logic:equal>    
    <logic:equal name="userinfo" property="sex" value="M"><bean:message 

key="userinfo.male"/>
    </logic:equal>     
    </td>
    <td class="td2"><bean:write name="userinfo" property="email"/></td>
    <td class="td2"><bean:write name="userinfo" property="phone"/></td>
    <td class="td2"> 
    <%
    	Userinfo userInfo1=(Userinfo)pageContext.getAttribute("userinfo");
    	Integer id=userInfo1.getId();
    %>
    <!-- 修改用户信息的链接-->
   <customtag:Authentication userId="<%=id%>" action="modify">
    <a href="/StrutsExample/ShowUserAction.do?method=modify&id=<bean:write name="userinfo" property="id"/>">
    <IMG height=18 alt=<bean:message key="global.edit"/> src="<%=imagesurl%>edit2.gif" width=17 align=middle border=0>
    </a>
    </customtag:Authentication>
   <!-- 删除用户信息的连接-->
    <customtag:Authentication action="delete">
    <a href="/StrutsExample/DeleteUserAction.do?id=<bean:write name="userinfo" 

property="id"/>" onclick="operateConfirm('<bean:message key="global.comfirmdel"/>')"><IMG 

height=18 alt=<bean:message key="global.delete"/> src="<%=imagesurl%>delete.gif" width=17 

align=center border=0></a>
</customtag:Authentication>

    </td>         
 
  </tr>
 </logic:iterate>    
 </table>
 </logic:present>
 </td>  
 </tr> 
</table>
<table border="0" width="100%">
<tr>
	<td>
	<!-- 显示出错信息-->
	   <div align=center>
	   <logic:messagesPresent>
                   <bean:message key="errors.header"/>
                   <ul>
                   <html:messages id="error">
                      <bean:message key="errors.prefix"/><bean:write name="error"/><bean:message key="errors.suffix"/><br>
                   </html:messages>
                   </ul><hr />
       </logic:messagesPresent>
	   </div>
	</td>
</tr>
</table>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -