jsp:useBean报错The value for the useBean class attribute X is invalid
一、解决方法
1.先检查<jsp:useBean id="dog" class="cn.edu.dgut.el.tools.Dog" scope="request" />
中完全限定名class是否正确,最好从来类中复制过来。
2.在javaBeanl类中添加无参构造方法,如:public Dog (){}
二、原因
这是因为<jsp:useBean id="dog" class="cn.edu.dgut.el.tools.Dog" scope="request" />
最终变成下面的代码:
cn.edu.dgut.el.tools.Dog dog=null
synchronized (request){
//先查询是否有已存在该对象
dog=(Dog)_jspx_page_context.getAttribute("Dog",PageContext.REQUEST_SCOPE); if(dog==null){ //没有就新建一个
dog=new Dog(); //注意:调用无参构造方法创建对象。
_jspx_page_context.setAttribute("persion",persion,PageContext.REQUEST_SCOPE);
}
}
从上面可以看出,在创建对象是调用了无参构造方法。所以在javaBean必须有无参构造方法。
jsp:useBean报错The value for the useBean class attribute X is invalid的更多相关文章
- jsp页面报错(一)
jsp页面报错 1.错误位置 <form action="../page/areaType.action" method="POST"> <j ...
- 数据库到jsp页面报错(一)
数据库到jsp页面报错(一) 这个错误的确比较坑. 控制台: 页面: 解决: 神坑啊!!!
- 安装pandas报错(AttributeError: 'module' object has no attribute 'main')
在pycharm中安装pandas出现报错:AttributeError: 'module' object has no attribute 'main', 刚开始以为是pip的版本太旧了,于是乎将其 ...
- 【pycharm】pycharm上安装tensorflow,报错:AttributeError: module 'pip' has no attribute 'main' 解决方法
pycharm上安装tensorflow,报错:AttributeError: module 'pip' has no attribute 'main' 解决方法 解决方法: 在pycharm的安装目 ...
- mybatis报错 Error instantiating interface com.atguigu.mybatis.dao.DepartmentMapper with invalid types () or values ()
mybatis报错 Error instantiating interface com.atguigu.mybatis.dao.DepartmentMapper with invalid types ...
- 解决:pipenv shell报错:AttributeError: 'module' object has no attribute 'run'
利用pipenv shell切换到虚拟环境时,显示报错:AttributeError: 'module' object has no attribute 'run' 可以看到是d:\program\p ...
- 【postman】postman测试API报错如下:TypeError: Failed to execute 'fetch' on 'Window': Invalid value 对中文支持不好
使用postman测试APi的时候,因为系统需要在header部带上登录用户的信息,所以 如下: 然后测试报错如下:TypeError: Failed to execute 'fetch' on 'W ...
- springboot项目启动报错Failed to configure a DataSource: 'url' attribute is not specified and no embedde
springboot项目启动报错Failed to configure a DataSource: 'url' attribute is not specified and no embedde 创建 ...
- Pycharm安装package报错:AttributeError: module 'pip' has no attribute 'main'
Pycharm安装package报错:AttributeError: module 'pip' has no attribute 'main' 确认pip已经升级到目前最新版本了. 在网上搜寻后,解决 ...
随机推荐
- C#爬虫(02):Web browser控件CefSharp的使用
一.CefSharp介绍 CEF 全称是Chromium Embedded Framework(Chromium嵌入式框架),是个基于Google Chromium项目的开源Web browser控件 ...
- idea教程--使用maven创建web项目
1.单击create new project 2.运行maven项目 在pom.xml文件中添加tomcat插件然后如下图运行;
- Pandas:从CSV中读取一个含有datetime类型的DataFrame、单项时间数据获取
前言 有一个CSV文件test.csv,其中有一列是datetime类型,其他列是数值列,就像下边这样: 问题 1.读取该CSV文件,把datetime列转换为datetime类型,并将它设置为索引列 ...
- Python:Scrapy(三) 进阶:额外的一些类ItemLoader与CrawlSpider,使用原理及总结
学习自:Python Scrapy 爬虫框架实例(一) - Blue·Sky - 博客园 这一节是对前两节内容的补充,涉及内容为一些额外的类与方法,来对原代码进行改进 原代码:这里并没有用前两节的代码 ...
- 华山论剑之 PostgreSQL sequence (一)
前言 本文是 sequence 系列继三大数据库 sequence 之华山论剑 (Oracle PostgreSQL MySQL sequence 十年经验总结) 之后的第二篇,主要分享一下 Post ...
- 非常详细的python和pycharm下载安装教程
目录 引言 为什么要学python 下载网址 python下载及安装 pycharm下载及安装 你人生中的第一句python 引言 Python诞生于1989年的一个圣诞节,其创作者Guido v ...
- glibc2.29以上 IO_FILE 及 house of pig
摆烂很长时间之后,终于下定决心来看点新的东西.正好 winmt 师傅前不久把他 pig 修好的附件发给我了,我就借此来学习一下新版本的 IO_FILE 及 house of pig. 新版本的 IO_ ...
- ENVI提取水系并进行生态敏感性分析
4 具体步骤 4.1 DEM数据拼接 (1)打开ENVI软件,选择[File][Open],添加文件夹DEM数据中的影像,操作如图4.1.1所示,结果如图4.1.2. 图4.1.1 添加DEM数据影像 ...
- Js 调用 webservice
<html> <head> <title>通过ajax调用WebServive服务</title> </head> <script t ...
- 『现学现忘』Docker基础 — 27、Docker镜像的commit操作
目录 1.commit命令作用 2.commit命令说明 3.示例演示 1.commit命令作用 在运行的容器中,并在镜像的基础上做了一些修改,我们希望保存起来,封装成一个新的镜像,方便我们以后使用, ...