Problems encountered by JSP page in spring boot+SSM project

FrontIndex.jsp page

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="java.util.List" %>
<%@ page import="com.ruoyu.bean.*" %>
<%@ page import="com.github.pagehelper.PageInfo" %>

<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path;
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>If fish Blog home page</title>
    <meta name="keywords" content=""/>
    <meta name="description" content=""/>
    <link href="<%=basePath%>/static/css/default.css" rel="stylesheet" type="text/css" media="screen"/>
</head>
<body>
<jsp:include page="view/FrontHead.jsp" flush="true"/>
<!-- start content -->
<div id="page">
    <div id="content">
        <%
                    List<ArticleCommentBean> articleCommentList = (List<ArticleCommentBean>) request.getAttribute("commentBeanList");
//        Map<String, Object> articleList = (Map<String, Object>) request.getAttribute("typeAndArtcile");
            PageInfo<ArticleMessage> articleList= (PageInfo<ArticleMessage>) session.getAttribute("pageInfo");
            if (articleList == null || articleList.getSize() == 0) {
        %>
        <div class="post">
            <h1 class="title">Welcome to Ruoyu blog!</h1>
            <p class="meta"><small>Bloggers in the current category haven't published articles yet</small></p>
            <div class="entry">
                <p>Wonderful coming...</p>
                <p class="more"><a href="#"> read the full text & hellip</a></p>
            </div>
        </div>

        <%
        } else {
            int i = 0;
            String username = "";
            int commentCount = 0;
            while (i < articleList.getSize()) {
                String articleTypeName = (String) articleList.getList().get(i).getArticleTypeName();
                if (articleTypeName == null || articleTypeName.equals(""))
                    articleTypeName = "Unclassified";
        %>
        <div class="post">
            <h2 class="title">[<%=articleList.getList().get(i).getArticleTypeName()%>]<%=articleList.getList().get(i).getArticleTitle()%>
            </h2>
            <p class="meta">
                <small><%=articleTypeName%>
                    //Published in <% = articlelist. Getlist(). Get (I). Getcreatedate()% >
                    <b>&nbsp;|&nbsp;</b>
                    //Read (<% = articlelist. Getlist(). Get (I). Getvisitcount()% >) < b > & nbsp; | & nbsp</b>
                    <a  href="comment/select" >
                        <input type="hidden" name="articleId" value="<%=articleList.getList().get(i).getArticleId()%>"/>
                    </a></small></p>
            <div class="entry">
                <p><%=articleList.getList().get(i).getArticleSummary()%>
                </p>
                <form action="/article/findById/find" method="post">
                    <p class="more"><a  href="#" >
                        <input type="hidden" name="articleId" value="<%=articleList.getList().get(i).getArticleId()%>"/>
                        <input type="submit" value="Read the whole passage..."/></a>
                    </p>
                </form>
            </div>
        </div>
        <%
                    i++;
                }
            }
        %>
        <div style="padding:10px;text-align: center" >
            <c:if test="<%=!articleList.isIsFirstPage()%>">
                <form action="/ruoyu" style="float: left ; align-content: center" method="post">
                    <input type="hidden" name="src" value="admin/article/mgrArticle"/>
                    <input type="hidden" name="pageNum" value="<%=articleList.getNavigateFirstPage()%>"/>
                    <input type="image" src="<%=basePath%>/static/images/first.png" onClick="document.name.submit()" style="text-align: center" />&nbsp;&nbsp;|
                </form>
            </c:if>

            <c:if test="<%=articleList.isHasPreviousPage()%>">
                <form action="/ruoyu" style="float: left;align-content: center" method="post">
                    <input type="hidden" name="src" value="admin/article/mgrArticle"/>
                    <input type="hidden" name="pageNum" value="<%=articleList.getPrePage()%>"/>
                    <input type="image" src="<%=basePath%>/static/images/pre.png" onclick="document.name.submit()" style="text-align: center" />&nbsp;&nbsp;|
                </form>
            </c:if>

            <c:forEach items="${pageInfo.navigatepageNums}" var="num">
                <form action="/ruoyu" style="float: left;color:${num eq pageInfo.pageNum?"red":""};align-content: center " method="post">
                    <input type="hidden" name="src" value="admin/article/mgrArticle"/>
                    <input type="hidden" name="pageNum" value="${num}"/>
                    <input type="submit" value="${num}" style="text-align: center"/>&nbsp;&nbsp;|
                </form>
            </c:forEach>

            <c:if test="<%=articleList.isHasNextPage()%>">
                <form action="/ruoyu" style="float: left;align-content: center" method="post">
                    <input type="hidden" name="src" value="admin/article/mgrArticle"/>
                    <input type="hidden" name="pageNum" value="<%=articleList.getNextPage()%>"/>
                    <input type="image" src="<%=basePath%>/static/images/next.png" onclick="document.name.submit()" style="text-align: center"/>&nbsp;&nbsp;|
                </form>
            </c:if>
            <c:if test="<%=!articleList.isIsLastPage()%>">
                <form action="/ruoyu" style="float: left;align-content: center" method="post">
                    <input type="hidden" name="src" value="admin/article/mgrArticle"/>
                    <input type="hidden" name="pageNum" value="<%=articleList.getNavigateLastPage()%>"/>
                    <input type="image" src="<%=basePath%>/static/images/last.png" onclick="document.name.submit()" style="text-align: center"/>
                </form>
            </c:if>
            //Current <% = articlelist. Getpagenum()% > / <% = articlelist. Getpages()% >
        </div>
    </div>
    <!-- end content -->
    <jsp:include page="view/FrontLeft.jsp" flush="true"/>
    <div style="clear: both;">&nbsp;</div>
</div>
<!-- start footer -->
<jsp:include page="view/FrontFoot.jsp" flush="true"/>
<!-- end footer -->
<%
    session.removeAttribute("pageInfo");
%>
</body>
</html>

Related codes in controller

@Controller
public class IndexController {
@Autowired
ArticleTypeService articleTypeService;

@Autowired
ArticleService articleService;

@Autowired
ArticleCommentService articleCommentService;

@Autowired
XbloUserService xbloUserService;

@Autowired
XbloLinkService xbloLinkService;

@Autowired
HttpServletRequest request;

@Autowired
HttpServletResponse response;

@RequestMapping("ruoyu")
public String toIndex(String pageNum){
    System.out.println("pageNum:"+pageNum+"-------------");
    if (pageNum==null || pageNum.equals("")) {
        pageNum="1";
    }
    int page = Integer.parseInt(pageNum);
    List<ArticleBean> articleBeanList = articleService.findAll();
    List<ArticleMessage> articleMessaege = articleService.findArticleMessaege(page);
    PageInfo<ArticleMessage> pageInfo = new PageInfo<>(articleMessaege);
    List<ArticleBean> top10 = articleService.findArticleTop10();
    List<ArticleTypeBean> typeBeanList = articleTypeService.findAll(page);
    List<XbloLinkBean> linkBeanList = xbloLinkService.findAll();
    request.getSession().setAttribute("articleBeanList",articleBeanList);
    request.getSession().setAttribute("pageInfo",pageInfo);
    request.getSession().setAttribute("typeBeanList",typeBeanList);
    request.getSession().setAttribute("linkBeanList",linkBeanList);
    request.getSession().setAttribute("top10",top10);
    System.out.println("END---");
    return "front/FrontIndex";
}
}

After accessing the homepage through localhost:8080/ruoyu, the mybatis log is as follows:

2020-03-13 15:13:46.556 INFO 1792 β€” [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2020-03-13 15:13:46.556 INFO 1792 β€” [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2020-03-13 15:13:46.563 INFO 1792 β€” [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 7 ms
pageNum:null-------------
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@4c261fb6] was not registered for synchronization because synchronization is not active
JDBC Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@2b04a3ce] will not be managed by Spring
> Preparing: select * from article order by visitCount desc
> Parameters:
< Columns: articleId, articleTypeId, articleTitle, articleSummary, articleContent, createDate, visitCount, createUserId
< row: 10, 3, songs divided into 222, d, j plan v watch 111, 2020-02-01, 564, 1
[= = row: 1, 1, song of ASF Assange, French scholar doctor at the age of French, then my point guard if iu opens a company to Australia, it's in line with you. In the past, I thought that the staff of May 72nd passed 11111111111111111111111111111111112222222222222222222222222222222222, 2020-02-19, 334, 2
< = = row: 11, 2, d have to do things, win more, lose less, e Weifeng, 2020-02-05, 233, 1
< = = row: 5, 2, but zoom in, SLKJHAG, kljsdhkadhfl, 2020-02-19, 200, 2
< = = row: 12, 1, results, more objective, regression, 2020-01-29, 43, 1
< = = row: 8, 1, doctor, yes or not, doctor, February 1, 2020, 23, 1
< = = row: 7, 2, journey to the west, overview of the journey to the west, content, 2020-02-05, 22, 1
<== Row: 4, 3, 666666, 666, 5555555555
, 2020-02-04, 20, 1
< = = row: 3, 1, Hongloumeng, Hongloumeng, Hongloumeng content 111, 2020-01-01, 14, 2
<== Row: 9, 2, dfgladjsfalksj, slkndfaskjgn, lsndfalksjdf, 2020-02-19, 10, 2
<== Row: 6, 2, articleTitle, articleSummary, articleContent1, 2019-12-31, 2, 1
< = = row: 2, 2, Augustine, compliance risk speculation and vinegar man, can Kangkang do after the way of avatar reform is modified? Ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha ha
, 2019-12-05, 1, 1
[= = row: 13, 1, all penguins. How can i go there? Oh, Hello! Reply to swipe the card, standardize Owen in the Buddha's cave, incubate me, go back hungry. Oh, i don't dare bully me and Buddhism after dinner. i'm looking forward to shopping completely. 2020-02-17, 0, 1
< = = row: 14, 2, test 14, test 14, 666666666666, 2020-03-11, 0, 3
<== Row: 15, 2, 15, 15, 15, 2020-03-11, 0, 4
< = = row: 16, 1, graduation project, 2020 graduation project, achievements, ha ha ha ha ha ha, 2020-02-24, 0, 1
<== Row: 17, 3, 16, 16, 16, 2020-03-11, 0, 5
<== Row: 18, 4, 18, 18, 18, 2020-03-11, 0, 6
<== Row: 19, 5, 19, 19, 19, 2020-03-11, 0, 7
<== Row: 22, 1, 2222222, 222222222, 2222222222222, 2020-02-25, 0, 1
<== Row: 23, 2, 111, 11111, 11111111112
, 2020-02-28, 0, 1
< = = row: 26, 41, test, test, test published article, 2020-03-02, 0, 1
<== Total: 22
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@4c261fb6]
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@30cf99fa] was not registered for synchronization because synchronization is not active
Cache Hit Ratio [SQL_CACHE]: 0.0
JDBC Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@2b04a3ce] will not be managed by Spring
> Preparing: SELECT count(0) FROM article AS a, articletype AS t, xblouser AS u WHERE t.articleTypeId = a.articleTypeId AND a.createUserId = u.xbloUserId
> Parameters:
< Columns: count(0)
< Row: 10
<== Total: 1
> Preparing: SELECT a.*,t.articleTypeName,u.xbloUsername FROM article AS a,articletype AS t,xblouser AS u WHERE t.articleTypeId = a.articleTypeId AND a.createUserId=u.xbloUserId order by visitCount desc LIMIT ?
> Parameters: 5(Integer)
< Columns: articleId, articleTypeId, articleTitle, articleSummary, articleContent, createDate, visitCount, createUserId, articleTypeName, xbloUsername
< row: 10, 3, songs divided into 222, d, j plan v watch 111, 2020-02-01, 564, 1, physics, admin
[= = row: 1, 1, song of ASF Assange, French scholar doctor at the age of French, then my point guard if iu opens a company to Australia, it's in line with you. In the past, I thought that the staff could go to Australia through 11111111111111111111111111111111112222222222222222222222222222222222222, 2020-02-19, 334, 2, mathematics, root
< = = row: 12, 1, result, more objective, regression, 2020-01-29, 43, 1, mathematics, admin
< = = row: 8, 1, doctor, yes or not, doctor, 2020-02-01, 23, 1, mathematics, admin
<== Row: 4, 3, 666666, 666, 5555555555
, 2020-02-04, 20, 1, physical, admin
<== Total: 5
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@30cf99fa]
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@7bc4ddd3] was not registered for synchronization because synchronization is not active
JDBC Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@2b04a3ce] will not be managed by Spring
> Preparing: SELECT * FROM article ORDER BY visitCount DESC Limit 0,10
> Parameters:
< Columns: articleId, articleTypeId, articleTitle, articleSummary, articleContent, createDate, visitCount, createUserId
< row: 10, 3, songs divided into 222, d, j plan v watch 111, 2020-02-01, 564, 1
[= = row: 1, 1, song of ASF Assange, French scholar doctor at the age of French, then my point guard if iu opens a company to Australia, it's in line with you. In the past, I thought that the staff of May 72nd passed 11111111111111111111111111111111112222222222222222222222222222222222, 2020-02-19, 334, 2
< = = row: 11, 2, d have to do things, win more, lose less, e Weifeng, 2020-02-05, 233, 1
< = = row: 5, 2, but zoom in, SLKJHAG, kljsdhkadhfl, 2020-02-19, 200, 2
< = = row: 12, 1, results, more objective, regression, 2020-01-29, 43, 1
< = = row: 8, 1, doctor, yes or not, doctor, February 1, 2020, 23, 1
< = = row: 7, 2, journey to the west, overview of the journey to the west, content, 2020-02-05, 22, 1
<== Row: 4, 3, 666666, 666, 5555555555
, 2020-02-04, 20, 1
< = = row: 3, 1, Hongloumeng, Hongloumeng, Hongloumeng content 111, 2020-01-01, 14, 2
<== Row: 9, 2, dfgladjsfalksj, slkndfaskjgn, lsndfalksjdf, 2020-02-19, 10, 2
<== Total: 10
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@7bc4ddd3]
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@73b4a55c] was not registered for synchronization because synchronization is not active
Cache Hit Ratio [SQL_CACHE]: 0.0
JDBC Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@2b04a3ce] will not be managed by Spring
> Preparing: SELECT count(0) FROM articleType
> Parameters:
< Columns: count(0)
< Row: 13
<== Total: 1
> Preparing: select * from articleType order by articleTypeId desc LIMIT ?
> Parameters: 5(Integer)
< Columns: articleTypeId, articleTypeName, articleTypeDesc
< row: 42, test 3, test 3
< = = row: 41, test2, test2
< = = row: 37, 1 modified, 1 modified
< = = row: 14, test 1, test 1
< = = row: 13, test 0, test new 0
<== Total: 5
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@73b4a55c]
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@742c13f8] was not registered for synchronization because synchronization is not active
JDBC Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@2b04a3ce] will not be managed by Spring
> Preparing: SELECT * FROM XbloLink
> Parameters:
< Columns: xbloLinkid, xbloLinkname, xbloLinkurl
< Row: 2, xbloLinkname, xbloLinkurl
< = = row: 3, Baidu, www.baidu.com
<== Row: 4, 3, 3
<== Row: 6, 6, 6
<== Row: 7, 7, 7
<== Row: 8, 8, 8
<== Row: 9, 9, 9
<== Row: 10, 10, 10
<== Row: 11, 11, 11
< = = row: 18, test 11, test 11
<== Total: 10
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@742c13f8]
ENDβ€”

Operation result

The right sidebar and the bottom are not displayed, and you are always prompted to load the localhost resource

My questions

It can be loaded before, but it can't be loaded later for no reason. You can only load the FrontHead column by adding flush = "true", but the following two columns are not loaded.

I hope that some friends who know this can give me some advice

Published 3 original articles, praised 0 and visited 75
Private letter follow

Tags: Session Apache JDBC JSP

Posted on Fri, 13 Mar 2020 03:42:54 -0400 by Jakebert