关于多表连接的jsp页面处理

这是一个关于如何在JSP页面上处理并展示多表连接查询结果的示例。页面利用了JSTL核心标签库和函数库,显示了作者的详细信息,包括ID、姓名、地区、关系人和作品等。数据通过AJAX请求获取,并在表格中以链接形式呈现,方便用户进一步操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!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">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="<%=request.getContextPath() %>/resources/css/bootstrap.css">
    <link rel="stylesheet" href="<%=request.getContextPath() %>/resources/css/starter-template.css">


    <script src="<%=request.getContextPath() %>/resources/js/ajax.js"></script>
    <script src="<%=request.getContextPath() %>/resources/js/ie-emulation-modes-warning.js"></script>
    <script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>


</head>
<body>
<%
    request.setCharacterEncoding("utf8");
%>
<div class="container">
    <div class="table-template">
        <div class="tableTitle">Result:</div>
        <br>
        <div class="table-responsive">
            <table border="1px" width="80%">
                <%--<div>${author.authorId} , ${author.authorName}  ${author.areaId} ${author.ifAuthor} ${author.areaName}</div>--%>
                <c:forEach var="author" items="${userList}" varStatus="status">
                    <font size="5" color="blue">
                        <tr>
                            <td>ID:</td>
                            <td colspan="2">${author.authorID}</td>
                        </tr>
                        <tr>
                            <td>姓名:</td>
                            <td colspan="2">${author.authorName}</td>
                        </tr>
                        <tr>
                            <td>地区:</td>
                            <td colspan="2">${author.areaName}</td>
                        </tr>
                        <c:forEach var="userRelation" items="${author.userRelationList}" varStatus="status">
                            <tr>
                                <td>关系:</td>
                                <td>${userRelation.relationType}:</td>
                                <td>
                                    <!--<B>${userRelation.relationAuthorName}</B>-->
                                    <c:set var="arr" value="${userRelation.relationAuthorName}" />
                                    <c:forEach items="${fn:split(arr,',')}" var="addr" begin="0"
                                               end="${fn:length(fn:split(arr,','))}" varStatus="stat">
                                        <a href = "<%=request.getContextPath() %>/common/search?comBox=author&keyWord=${addr}">${addr}</a> 
                                    </c:forEach>

                                </td>
                            </tr>
                            <%--关系:${userRelation.relationType}<br>
                            关系人:<a href="">${userRelation.relationAuthorName}</a><br>--%>
                            <%--关系:${userRelation.relationType}<br>--%>
                            <%--关系人:--%>
                            <%--<c:forEach var="relationTypes" items="${userRelation.relationType}">--%>
                            <%--${userRelation.relationAuthorName},--%>
                            <%--</c:forEach>--%>
                        </c:forEach>
                        <tr>
                            <td>门派:</td>
                            <td colspan="2"><c:forEach var="paiName" items="${author.paiNameList}" varStatus="status">${paiName},</c:forEach></td>
                        </tr>
                        <tr>
                            <td>作品:</td>
                            <td colspan="2"><c:forEach var="workName" items="${author.workNameList}" varStatus="status">${workName},</c:forEach></td>
                        </tr>
                    </font>
                </c:forEach>
            </table>
        </div>
    </div>
    <br>
</div>



<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="<%=request.getContextPath() %>/resources/js/ie10-viewport-bug-workaround.js"></script>

<script type="text/javascript">
    function getWord(){
        //val name = document.getElementsByTagName("B");

    }
</script>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值