前端jsp界面一些固定模板

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<body>
<%
Object message = request.getAttribute("message");
if(message!=null && !"".equals(message)){

%>
<script type="text/javascript">
alert("<%=request.getAttribute("message")%>");
</script>
<%} %>
<center>
<table>
<c:forEach items="${home}" var="item">
<tr>
<td>${item.id}</td><td>${item.baojia}</td><td> <a href="houtai?method=chaxun1&id=${item.id}">${item.dizhi}</a></td>
</tr>
</c:forEach>
</table>
</center>
</body>
</html>

其中home是servlet层传递的参数,类型通常为list型,通过c标签可以实现遍历

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<html>
<body>

<center>
<table class="tb">
<tr>
<td>${f.id}</td>
<td>${f.huxing}</td>
<td>${f.dizhi}</td>
<td>${f.nianfen}</td>
<td>${f.mianji}</td>
<td>${f.baojia}</td>
<td>${f.zhuangtai}</td>
</tr>
</table>
</center>
<br>
</body>
</html>

f同样为servlet层传递的参数,但是类型通常为bean层的某一类

posted @ 2022-12-29 21:49  小趴菜且能喝66  阅读(181)  评论(0编辑  收藏  举报