会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 132906个问题

matplotlib01.rar

为什么字体还是没有显示出哎?

Python 全系列/第十七阶段:数据分析-数据可视化/matplotlib 19786楼

老师遇到状态码500的错误

canvas.png

package com.bjsxt.servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;

public class respByteServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        /*图片载入*/
        File file=new File("d:/zhw.jpg");
        /*输出流*/
        FileInputStream fis=new FileInputStream("file");
        /*存入数组*/
        byte[] buff=new byte[fis.available()];
        fis.read(buff);/*读数据*/


        /*设置响应类型*/
        resp.setContentType("image/jpeg");
       /*用字节输出流*/
        OutputStream os=resp.getOutputStream();
        os.write(buff);/*写数据*/
        os.flush();
        os.close();
     }1
}
<servlet>
    <servlet-name>respByteServlet</servlet-name>
    <servlet-class>com.bjsxt.servlet.respByteServlet</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>respByteServlet</servlet-name>
    <url-pattern>/byte.do</url-pattern>
</servlet-mapping>

老师麻烦指导一下。。

JAVA 全系列/第五阶段:JavaWeb开发/Servlet技术详解(旧) 19787楼

老师帮忙看看哪里出错了


Exception in thread "main" java.lang.ExceptionInInitializerError

 at com.bjsxt.test.SelectUsersByIdTest.main(SelectUsersByIdTest.java:10)

Caused by: org.apache.ibatis.exceptions.PersistenceException: 

### Error building SqlSession.

### The error may exist in SQL Mapper Configuration

### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.github.pagehelper.PageInterceptor'.  Cause: java.lang.ClassNotFoundException: Cannot find class: com.github.pagehelper.PageInterceptor

 at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)

 at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:80)

 at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:64)

 at com.bjsxt.utils.MybatisUtils.<clinit>(MybatisUtils.java:22)

 ... 1 more

Caused by: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.github.pagehelper.PageInterceptor'.  Cause: java.lang.ClassNotFoundException: Cannot find class: com.github.pagehelper.PageInterceptor

 at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:122)

 at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:99)

 at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:78)

 ... 3 more

Caused by: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.github.pagehelper.PageInterceptor'.  Cause: java.lang.ClassNotFoundException: Cannot find class: com.github.pagehelper.PageInterceptor

 at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuil


JAVA 全系列/第六阶段:项目管理与SSM框架/Mybatis 19789楼
JAVA 全系列/第十二阶段:Spring Cloud Alibaba技术栈/Zookeeper 19791楼
Python 全系列/第一阶段:Python入门/编程基本概念 19792楼

t_m_r = db.Table('t_menu_role',
               db.Column('rid', db.Integer, db.ForeignKey('t_role.id')),
               db.Column('mid', db.Integer, db.ForeignKey('t_menu.id'))
               )

class Menu(db.Model):
    __tablename__ = 't_menu'
    id = db.Column(db.Integer, unique=True, primary_key=True)
    name = db.Column(db.String(32), unique=True, nullable=False)
    level = db.Column(db.Integer)
    path = db.Column(db.String(32))

    pid = db.Column(db.Integer, db.ForeignKey('t_menu.id'))
    children = db.relationship('Menu')
    roles = db.relationship('Role', secondary=t_m_r)

    def to_dict(self):
        return {
            'id': self.id,
            'name': self.name,
            'level': self.level,
            'path': self.path,
            'pid': self.pid
        }
    
    def get_child_list(self):
        obj_child = self.children
        data = []
        for o in obj_child:
            data.append(o.to_dict())
        return data

class Role(db.Model):
    __tablename__ = 't_role'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(32), unique=True, nullable=False)
    describe = db.Column(db.String(64))

    # 与用户的关联
    users = db.relationship('User', backref='role')
    menus = db.relationship('Menu', secondary=t_m_r)

    def to_dict(self):
        return {
            'id': self.id,
            'name': self.name,
            'describe': self.describe,
            'menu': self.get_menu_list()
        }
    
    def get_menu_list(self):
        menu_list = []
        for m in self.menus:
            if m.level == 1:
                m_dict = m.to_dict()
                m_dict['children'] = m.get_child_list()
                menu_list.append(m_dict)
        return menu_list

图片.png

老师,这边关联数据库报了这个警告,每次查询role表跟menu表时都会

Python 全系列/第九阶段:Flask百战电商后台系统/Flask百战电商后台项目 19795楼
JAVA 全系列/第五阶段:JavaWeb开发/Ajax技术详解(旧) 19800楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637