spring boot+SSM项目中JSP页面遇到的问题

FrontIndex.jsp页面

<%@ 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>若鱼Blog首页</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">欢迎使用若鱼blog!</h1>
            <p class="meta"><small>当前类别下博主还未发表文章</small></p>
            <div class="entry">
                <p>精彩即将来临...</p>
                <p class="more"><a href="#">阅读全文&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 = "未分类";
        %>
        <div class="post">
            <h2 class="title">[<%=articleList.getList().get(i).getArticleTypeName()%>]<%=articleList.getList().get(i).getArticleTitle()%>
            </h2>
            <p class="meta">
                <small><%=articleTypeName%>
                    发布于 <%=articleList.getList().get(i).getCreateDate()%>
                    <b>&nbsp;|&nbsp;</b>
                    阅读 (<%=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="阅读全文..."/></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>
            当前第<%=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>

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";
}
}

首页通过localhost:8080/ruoyu访问后mybatis日志如下:

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, 分为222, d的歌, j计划v看111, 2020-02-01, 564, 1
<== Row: 1, 1, asf阿桑的歌, 法国岁的法国士大夫吧, 然后我得分后卫如果iu开公司赴澳符合大家看u过去我认为人员五七二通过多方11111111111111111111111111111111112222222222222222222222, 2020-02-19, 334, 2
<== Row: 11, 2, d得事干, 胜多负少, 额威风, 2020-02-05, 233, 1
<== Row: 5, 2, 可是放大, SLKJHAG, kljsdhkadhfl, 2020-02-19, 200, 2
<== Row: 12, 1, 结果, 更客观, 回归, 2020-01-29, 43, 1
<== Row: 8, 1, 发士大夫, 是否是, 发士大夫, 2020-02-01, 23, 1
<== Row: 7, 2, 西游记, 西游概述, 内容, 2020-02-05, 22, 1
<== Row: 4, 3, 666666, 666, 5555555555
, 2020-02-04, 20, 1
<== Row: 3, 1, 红楼梦, 红楼梦, 红楼梦内容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, 奥古斯丁, 合规风险投机和果醋人, 阿凡达方式改革的方式修改之后康康行不行哈哈哈哈哈哈哈哈
, 2019-12-05, 1, 1
<== Row: 13, 1, 全是企鹅, 请问请问方法去非常好多, 欸哦咯回复刷卡大家佛窟规范化欧文去孵化我回去饿哦i饭后后i无阿敢欺负我和佛教看求购覅完全, 2020-02-17, 0, 1
<== Row: 14, 2, 测试14, 测试14, 666666666666666666, 2020-03-11, 0, 3
<== Row: 15, 2, 15, 15, 15, 2020-03-11, 0, 4
<== Row: 16, 1, 毕业设计, 2020年毕业设计,成果, 哈哈哈哈哈哈哈哈, 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, 测试, 测试, 测试发表文章, 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, 分为222, d的歌, j计划v看111, 2020-02-01, 564, 1, 物理, admin
<== Row: 1, 1, asf阿桑的歌, 法国岁的法国士大夫吧, 然后我得分后卫如果iu开公司赴澳符合大家看u过去我认为人员五七二通过多方11111111111111111111111111111111112222222222222222222222, 2020-02-19, 334, 2, 数学, root
<== Row: 12, 1, 结果, 更客观, 回归, 2020-01-29, 43, 1, 数学, admin
<== Row: 8, 1, 发士大夫, 是否是, 发士大夫, 2020-02-01, 23, 1, 数学, admin
<== Row: 4, 3, 666666, 666, 5555555555
, 2020-02-04, 20, 1, 物理, 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, 分为222, d的歌, j计划v看111, 2020-02-01, 564, 1
<== Row: 1, 1, asf阿桑的歌, 法国岁的法国士大夫吧, 然后我得分后卫如果iu开公司赴澳符合大家看u过去我认为人员五七二通过多方11111111111111111111111111111111112222222222222222222222, 2020-02-19, 334, 2
<== Row: 11, 2, d得事干, 胜多负少, 额威风, 2020-02-05, 233, 1
<== Row: 5, 2, 可是放大, SLKJHAG, kljsdhkadhfl, 2020-02-19, 200, 2
<== Row: 12, 1, 结果, 更客观, 回归, 2020-01-29, 43, 1
<== Row: 8, 1, 发士大夫, 是否是, 发士大夫, 2020-02-01, 23, 1
<== Row: 7, 2, 西游记, 西游概述, 内容, 2020-02-05, 22, 1
<== Row: 4, 3, 666666, 666, 5555555555
, 2020-02-04, 20, 1
<== Row: 3, 1, 红楼梦, 红楼梦, 红楼梦内容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, 测试3, 测试3
<== Row: 41, 测试2, 测试2
<== Row: 37, 1修改, 1修改
<== Row: 14, 测试1, 测试1
<== Row: 13, 测试0, 测试新增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, 百度, 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, 测试11, 测试11
<== Total: 10
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@742c13f8]
END—

运行结果

spring boot+SSM项目中JSP页面遇到的问题右侧边栏和底部没有显示,且一直提示加载localhost资源中

我的疑问

以前是能加载出来的,但是后来莫名其妙就加载不出来了,只有加上flush=“true”才能加载出来头部FrontHead栏,但是下面两栏没有加载出来。

希望有懂这方面的朋友能指点一下或者给点建议

上一篇:Locks and Synchronization锁与同步


下一篇:java-同步的价格是多少?