JavaWeb学习——EL与JSTL程序示例

<%@ page contentType="text/html; charset=utf-8"
         pageEncoding="utf-8" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>Insert title here</title>
    </head>
    <body>
        <table border="1" width="800px">
            <tr>
                <th>姓名</th>
                <th>性别</th>
                <th>出生日期</th>
                <th>专业</th>
            </tr>
            <c:forEach items="${requestScope.data}" var="data">
                <tr>
                    <td>${data.sname}</td>
                    <td>
                        <c:if test="${data.sex==1}">男</c:if>
                        <c:if test="${data.sex==2}">女</c:if>
                            <%--<input type="radio" name="sex" value="2" <%="2".equals(stu.get("sex"))?"checked=\"checked\"":""%>/>女--%>
                    </td>
                    <td><fmt:formatDate pattern="yyyy年MM月dd日" value="${data.birthday}"/></td>
                    <td>${data.major}</td>
                </tr>
            </c:forEach>
        </table>
    </body>
</html>

猜你喜欢

转载自blog.csdn.net/weixin_41577923/article/details/83021180