学习进度第五周

时间 10
代码量 300左右
博客园 2
知识点

 

request.getAttribute  用来接受req.setAttribute传过来的值
 <c:forEach items="${ones}" var="item" varStatus="status">
    遍历数组,获取传过来ones的值数组遍历出来

 

  

<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>一号线</title>
<style>
    .a{
        margin-top: 20px;
    }
    .b{
        font-size: 20px;
        width: 160px;
        color: white;
        background-color: greenyellow;
    }
</style>
</head>
<body>
    <div align="center">
        <form action="SubwayServlet?method=one_line" method="post" onsubmit="return check()">
                <div class="a">
                    一号线
            </div>
            <div class="a">
                <button type="submit" class="b">查&nbsp;&nbsp;&nbsp;&nbsp;询</button>
            </div>
        </form>
    </div>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
 <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>一号线</title>
<style>
    .a{
        margin-top: 20px;
    }
    .b{
        font-size: 20px;
        width: 160px;
        color: white;
        background-color: greenyellow;
    }
    .tb, td {
        border: 1px solid black;
        font-size: 22px;
    }
</style>
</head>
<body>
    <div align="center">
    <table class="tb">
            <tr>
                <td>站台</td>
                <td>线路</td>
                <td>时间</td>
                <td>起点站——终点站</td>
                <td>站台</td>
            </tr>
            <!-- forEach遍历出adminBeans -->
            <c:forEach items="${ones}" var="item" varStatus="status">
                <tr>
                    <td>${item.id}</td>
                    <td><a>${item.line}</a></td>
                    <td>${item.intro}</td>
                    <td>${item.route}</td>
                    <td>${item.site}</td>
                </tr>
            </c:forEach>
        </table>
    </div>

</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style>
    .a{
        margin-top: 20px;
    }
    .b{
        font-size: 20px;
        width: 160px;
        color: white;
        background-color: greenyellow;
    }
</style>
</head>
<body>
    <div align="center">
        <form action="SubwayServlet?method=transfer" method="post" onsubmit="return check()">
            <div class="a">
                起点站<input type="text" id="site1" name="site1"/>
            </div>
            <div class="a">
                终点站<input type="text" id="site2" name="site2" />
            </div>
            <div class="a">
                <button type="submit" class="b">查&nbsp;&nbsp;&nbsp;&nbsp;询</button>
            </div>
        </form>
    </div>

</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style>
    .a{
        margin-top: 20px;
    }
    .b{
        font-size: 20px;
        width: 160px;
        color: white;
        background-color: greenyellow;
    }
    .tb, td {
        border: 1px solid black;
        font-size: 22px;
    }
</style>
</head>
<body>
    <div align="center">
        <table class="tb">
            <tr>
                
                <td></td>
                <td>线路</td>
                <td>车次</td>
            <tr></tr>
            
            <tr>
                <td rowspan="2">中间站</td>
                <td><%=request.getAttribute("stations1") %></td>
                <td><%=request.getAttribute("line1") %></td>
            </tr>
            <tr>
                <td><%=request.getAttribute("stations2") %></td>
                <td><%=request.getAttribute("line2") %></td>
            </tr>
        </table>
    </div>
</body>
</html>

  知识点:

request.getAttribute  用来接受req.setAttribute传过来的值
 <c:forEach items="${ones}" var="item" varStatus="status">
    遍历数组,获取传过来ones的值数组遍历出来
posted @ 2019-04-06 18:40  birdmmxx  阅读(174)  评论(0编辑  收藏  举报