Jsp import 默认包class 的问题
来源:互联网 发布:数组奇偶 编辑:程序博客网 时间:2024/04/28 12:16
在JSP中导入自定义类,User定义在默认的包下,如下:
<%@ page language="java" import="User" %>
然后,
<% User u = new User(); %>
运行即出现:
The import User cannot be resolved
将User类改成自定义包中的类,如下:
com.test.importclass.User,运行成功。
google "jsp import default package", 发现:class一定要写在包中,如果你珍爱生命的话。
"Many people on JavaRanch, including those most prone to answering questions, will quickly lose patience with someone who isn't willing to package all of their classes before trying to debug an issue (any issue), even if packaging doesn't seem to be related to their current problem."
参考:
http://www.jguru.com/forums/view.jsp?EID=1294104
http://www.coderanch.com/t/292944/JSP/java/Jsp-import
http://www.coderanch.com/how-to/java/PackageYourBeans
- Jsp import 默认包class 的问题
- Jsp import 默认包class 的问题
- @class和#import的细节问题
- import默认包中的类
- #import、#include、@class、#import<> 、#import""的区别
- vscode 解决import github包的问题
- Python import各种包遇到的问题
- MyEclipse js / class / jsp 默认打开方式 中文乱码问题
- #import @class 的区别
- #import @class 的区别
- JSP页面出现同名类包import冲突的解决办法 collides with another import statement
- java中import默认包中的类
- iOS - @class ,#import" ",#import<>的区别
- import 包的错误
- jsp <%@ page import="" %>问题
- 浅谈<jsp:useBean />与<% import>引包
- 解决eclipse 不能自动import包的问题
- #import和@Class的区别
- MySQL:日期函数、时间函数总结(MySQL 5.X)
- ABAP开发实用快捷键 版本:SAP GUI710
- hibernate之Hibernate.initialize(Obj)用法
- mysql如何计算日期加减天数
- Broadcast广播机制【安卓入门三】
- Jsp import 默认包class 的问题
- 相对高性能的表关联
- 公司电脑不可以连外网
- 记一下。。某大牛的blog。。免得搞丢了
- 取无符号日期具体信息
- SQLite快速入门【安卓入门四】
- ASP入门(十三): Ad & Content Rotator
- android的常用控件总结【安卓入门五】
- vi/vim 基本使用方法