首页 > 代码库 > JSP开发记录

JSP开发记录

1.基础属性

技术分享
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.tgb.*" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
List list=(List)request.getAttribute("list");
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
View Code

 

2.遍历list

技术分享
        <c:forEach items="${list}" var="user" varStatus="vs">  
                <tr>   
                     <td align = "center">${user.getID()}</td>  
                     <td align = "center">${user.getUserName()}</td>  
                     <td align = "center">${user.getPassword()}</td>  
                     <td align = "center"><img src="${user.getHeadImage()}" style="height: 50px;width: 50px;"/></td>  
                      <td>
                          <a href="user.html"><i class="icon-pencil"></i></a>
                          <a href="#myModal" role="button" data-toggle="modal"><i class="icon-remove"></i></a>
                      </td>                       
                 </tr>  
        </c:forEach>  
View Code

 

3.加载子页面

<jsp:include page="../../layout/footer.jsp"></jsp:include>

 

JSP开发记录