没有报错信息,列表页是空白的

没有报错信息,列表页是空白的

"C:\Program Files\Java\jdk1.7.0_80\bin\java.exe" -Dcatalina.base=C:\Users\82062\.IntelliJIdea2018.3\system\tomcat\Unnamed_shopmgr -Dcatalina.home=D:\developTools\tomcat\tomcat7\tomcat7 -Djava.io.tmpdir=D:\developTools\tomcat\tomcat7\tomcat7\temp -Dcom.sun.management.jmxremote= -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=127.0.0.1 -cp D:\developTools\tomcat\tomcat7\tomcat7\bin\bootstrap.jar;D:\developTools\tomcat\tomcat7\tomcat7\bin\tomcat-juli.jar org.apache.catalina.startup.Bootstrap start

[2018-12-12 10:28:16,273] Artifact shopmgr:war: Waiting for server connection to start artifact deployment...

十二月 12, 2018 10:28:16 上午 org.apache.catalina.startup.VersionLoggerListener log

信息: Server version:        Apache Tomcat/7.0.92

十二月 12, 2018 10:28:16 上午 org.apache.catalina.startup.VersionLoggerListener log

信息: Server built:          Nov 9 2018 11:07:44 UTC

十二月 12, 2018 10:28:16 上午 org.apache.catalina.startup.VersionLoggerListener log

信息: Server number:         7.0.92.0

十二月 12, 2018 10:28:16 上午 org.apache.catalina.startup.VersionLoggerListener log

信息: OS Name:               Windows 8.1

十二月 12, 2018 10:28:16 上午 org.apache.catalina.startup.VersionLoggerListener log

信息: OS Version:            6.3

十二月 12, 2018 10:28:16 上午 org.apache.catalina.startup.VersionLoggerListener log

信息: Architecture:          amd64

十二月 12, 2018 10:28:16 上午 org.apache.catalina.startup.VersionLoggerListener log

信息: Java Home:             C:\Program Files\Java\jdk1.7.0_80\jre

十二月 12, 2018 10:28:16 上午 org.apache.catalina.startup.VersionLoggerListener log

信息: JVM Version:           1.7.0_80-b15

十二月 12, 2018 10:28:16 上午 org.apache.catalina.startup.VersionLoggerListener log

信息: JVM Vendor:            Oracle Corporation

十二月 12, 2018 10:28:16 上午 org.apache.catalina.startup.VersionLoggerListener log

信息: CATALINA_BASE:         C:\Users\82062\.IntelliJIdea2018.3\system\tomcat\Unnamed_shopmgr

十二月 12, 2018 10:28:16 上午 org.apache.catalina.startup.VersionLoggerListener log

信息: CATALINA_HOME:         D:\developTools\tomcat\tomcat7\tomcat7

十二月 12, 2018 10:28:16 上午 org.apache.catalina.startup.VersionLoggerListener log

信息: Command line argument: -Dcatalina.base=C:\Users\82062\.IntelliJIdea2018.3\system\tomcat\Unnamed_shopmgr

十二月 12, 2018 10:28:16 上午 org.apache.catalina.startup.VersionLoggerListener log

信息: Command line argument: -Dcatalina.home=D:\developTools\tomcat\tomcat7\tomcat7

十二月 12, 2018 10:28:16 上午 org.apache.catalina.startup.VersionLoggerListener log

信息: Command line argument: -Djava.io.tmpdir=D:\developTools\tomcat\tomcat7\tomcat7\temp

十二月 12, 2018 10:28:16 上午 org.apache.catalina.startup.VersionLoggerListener log

信息: Command line argument: -Dcom.sun.management.jmxremote=

十二月 12, 2018 10:28:16 上午 org.apache.catalina.startup.VersionLoggerListener log

信息: Command line argument: -Dcom.sun.management.jmxremote.port=1099

十二月 12, 2018 10:28:16 上午 org.apache.catalina.startup.VersionLoggerListener log

信息: Command line argument: -Dcom.sun.management.jmxremote.ssl=false

十二月 12, 2018 10:28:16 上午 org.apache.catalina.startup.VersionLoggerListener log

信息: Command line argument: -Dcom.sun.management.jmxremote.authenticate=false

十二月 12, 2018 10:28:16 上午 org.apache.catalina.startup.VersionLoggerListener log

信息: Command line argument: -Djava.rmi.server.hostname=127.0.0.1

十二月 12, 2018 10:28:16 上午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent

信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.7.0_80\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\Common Files\NetSarang;C:\Program Files\Java\jdk1.7.0_80\bin;D:\developTools\maven\apache-maven-3.5.0\bin;C:\Program Files\Java\jdk1.7.0_80\bin;C:\Program Files\Java\jre7\bin;SystemRoot%\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;c:\windows\system32;D:\developTools\Mysql\mysql-5.7.24-winx64\bin;D:\developTools\Mysql\bin;D:\developTools\python\python3\Scripts\;D:\developTools\python\python3\;C:\Users\82062\AppData\Local\Microsoft\WindowsApps;;D:\developTools\Pycharm\Pythcharm\PyCharm 2018.3.1\bin;;D:\developTools\intellijidea\idea3.1\IntelliJ IDEA 2018.3.1\bin;;.

十二月 12, 2018 10:28:17 上午 org.apache.coyote.AbstractProtocol init

信息: Initializing ProtocolHandler ["http-bio-8080"]

十二月 12, 2018 10:28:17 上午 org.apache.coyote.AbstractProtocol init

信息: Initializing ProtocolHandler ["ajp-bio-8009"]

十二月 12, 2018 10:28:17 上午 org.apache.catalina.startup.Catalina load

信息: Initialization processed in 363 ms

十二月 12, 2018 10:28:17 上午 org.apache.catalina.core.StandardService startInternal

信息: Starting service Catalina

十二月 12, 2018 10:28:17 上午 org.apache.catalina.core.StandardEngine startInternal

信息: Starting Servlet Engine: Apache Tomcat/7.0.92

十二月 12, 2018 10:28:17 上午 org.apache.coyote.AbstractProtocol start

信息: Starting ProtocolHandler ["http-bio-8080"]

十二月 12, 2018 10:28:17 上午 org.apache.coyote.AbstractProtocol start

信息: Starting ProtocolHandler ["ajp-bio-8009"]

十二月 12, 2018 10:28:17 上午 org.apache.catalina.startup.Catalina start

信息: Server startup in 39 ms

Connected to server

[2018-12-12 10:28:17,322] Artifact shopmgr:war: Artifact is being deployed, please wait...

十二月 12, 2018 10:28:18 上午 org.apache.catalina.deploy.WebXml setVersion

警告: Unknown version string [3.1]. Default version will be used.

十二月 12, 2018 10:28:19 上午 org.apache.catalina.startup.TldConfig execute

信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.

十二月 12, 2018 10:28:19 上午 org.apache.catalina.core.ApplicationContext log

信息: No Spring WebApplicationInitializer types detected on classpath

十二月 12, 2018 10:28:19 上午 org.apache.catalina.core.ApplicationContext log

信息: Initializing Spring root WebApplicationContext

log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).

log4j:WARN Please initialize the log4j system properly.

log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

[2018-12-12 10:28:19,919] Artifact shopmgr:war: Artifact is deployed successfully

[2018-12-12 10:28:19,919] Artifact shopmgr:war: Deploy took 2,597 milliseconds

十二月 12, 2018 10:28:20 上午 org.apache.jasper.compiler.TldLocationsCache tldScanJar

信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.

十二月 12, 2018 10:28:27 上午 org.apache.catalina.startup.HostConfig deployDirectory

信息: Deploying web application directory D:\developTools\tomcat\tomcat7\tomcat7\webapps\manager

十二月 12, 2018 10:28:27 上午 org.apache.catalina.startup.HostConfig deployDirectory

信息: Deployment of web application directory D:\developTools\tomcat\tomcat7\tomcat7\webapps\manager has finished in 62 ms

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
   PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
   "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="com.imooc.shop.repository.ArticleMapper">
    <sql id="pageWhere">
        <where>
            <if test="typeCode != null &amp;&amp; typeCode !=''">
                and TYPE_CODE like CONCAT("",#{typeCode},"%")
            </if>
            <if test="secondType != null &amp;&amp; secondType !=''">
                and TYPE_CODE = #{secondType}
            </if>
            <if test="title != null &amp;&amp; title !=''">
                and title like CONCAT("%",#{title},"%")
            </if>
        </where>
    </sql>
   <select id="searchArticles" resultType="com.imooc.shop.bean.Article">
      select * from ec_article
      <include refid="pageWhere"></include>
        limit #{pager.firstParam},#{pager.pageSize}
   </select>

    <select id="count" resultType="int">
        select count(*) from ec_article
        <include refid="pageWhere"></include>
    </select>
</mapper>
package com.imooc.shop.repository;


import com.imooc.shop.bean.Article;
import com.imooc.shop.bean.ArticleType;
import com.imooc.shop.utils.Pager;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ArticleMapper {

    List<Article> searchArticles(@Param("typeCode") String typeCode, @Param("secondType") String secondType, @Param("title") String title, @Param("pager") Pager pager);

    int conut(@Param("typeCode") String typeCode, @Param("secondType") String secondType, @Param("title") String title, @Param("pager") Pager pager );
}
package com.imooc.shop.action;

import com.imooc.shop.bean.Article;
import com.imooc.shop.bean.ArticleType;
import com.imooc.shop.service.ShopService;
import com.imooc.shop.utils.Pager;
import org.springframework.util.StringUtils;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/list")
public class ListServlet extends HttpServlet {

    //定义业务层对象
    private ShopService shopService;

    private HttpServletRequest request;
    private HttpServletResponse response;

    @Override
    public void init() throws ServletException {
        super.init();
        //获取spring的容器。然后从容器中得到业务层的对象
        ServletContext servletContext = this.getServletContext();
        WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);
        shopService = (ShopService) context.getBean("shopService");
    }

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        try {
            this.request = req;
            this.response = resp;
            request.setCharacterEncoding("UTF-8");
            response.setCharacterEncoding("UTF-8");
            String methd = req.getParameter("method");
            switch (methd) {
                case "getAll":
                    getAll();
                    break;
            }

        } catch (Exception e) {

        }
    }

    private void getAll() throws ServletException, IOException {
        //考虑分页查询
        Pager pager = new Pager();

        //看是否传入了分页参数的页码
        String pageIndex = request.getParameter("pageIndex");
        if (!StringUtils.isEmpty(pageIndex)) {
            int pSize = Integer.valueOf(pageIndex);
            pager.setPageIndex(pSize);
        }
        String secondType = request.getParameter("secondType");
        String title = request.getParameter("title");
        request.setAttribute("secondType",secondType);
        request.setAttribute("title",title);
        //接收一级类型编号查询
        String typeCode = request.getParameter("typeCode");
        //根据一级类型查询二级类型
        if (!StringUtils.isEmpty(typeCode)) {
            List<ArticleType> secondTypes = shopService.loadSecondTypes(typeCode);
            request.setAttribute("typeCode",typeCode);
            request.setAttribute("secondTypes",secondTypes);
        }
        //1.查询所有的一级类型
        List<ArticleType> firstArticleTypes = shopService.loadFirstArticleType();
        //2.查询所有的商品信息
        List<Article> articles = shopService.searchArticles(typeCode,secondType,title,pager);
        request.setAttribute("firstArticleTypes", firstArticleTypes);
        request.setAttribute("pager",pager);
        request.setAttribute("articles", articles);
        request.getRequestDispatcher("/WEB-INF/jsp/list.jsp").forward(request, response);
    }
}

http://img1.sycdn.imooc.com//climg/5c10732700010cdb18740977.jpg

正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

3回答
chrismorgen 2018-12-12 18:08:38

1、建议同学在浏览器中按F12,看一下浏览器中的报错提示是什么?

2、你导入老师的代码试试,看是否也会出现你的问题,并且建议你在getAll方法中输出一条语句,看有没有执行getAll方法,祝学习愉快~

http://img1.sycdn.imooc.com//climg/5c10de0400019a0e06840469.jpg

提问者 仓鼠好萌啊 2018-12-12 14:58:15

http://img1.sycdn.imooc.com//climg/5c10b16e00016a8610250756.jpg

我勾选了但是没有日志显示,我也不知道为什么

  • 因为没有报错提示,不知道同学的项目发生了什么问题,建议你导入老师的源码试试,看是否会发生相同的问题,祝学习愉快~
    2018-12-12 15:19:35
  • 提问者 仓鼠好萌啊 回复 chrismorgen #2
    我就是做完分页以后出的问题,分页前都好好的。。
    2018-12-12 15:46:37
chrismorgen 2018-12-12 14:15:16

你好同学,建议你看一下下图标记的两个窗口中有没有报错信息,如果有,建议将报错信息粘贴一下,祝学习愉快~

http://img1.sycdn.imooc.com//climg/5c10a77000014c8b04390159.jpg

  • 提问者 仓鼠好萌啊 #1
    勾选了,但是没有日志显示,我也不知道为什么
    2018-12-12 14:58:38
  • 提问者 仓鼠好萌啊 #2
    老师,很急,这个怎么处理.......
    2018-12-12 15:09:47
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
SSM主流框架入门与综合项目实战2018版
  • 参与学习           人
  • 提交作业       205    份
  • 解答问题       4317    个

Java中非常实用的SSM整合开发内容,从Spring开始,到MyBaits的进阶内容,再到SpringMVC的应用,最后是SSM整合开发案例,逐步深入,助你成长为一名Java工程师!

了解课程
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师