java - Eclipse cannot find imports : com.oreilly.servlet.* , org.apache.commons.io.*
问题描述
<%@page contentType="text/html;charset=euc-kr"%>
<%@page import="com.oreilly.servlet.MultipartRequest" %>
<%@page import="com.oreilly.servlet.multipart.DefaultFileRenamePolicy"%>
<%@page import="java.util.*,java.io.*"%>
<%
String saveFolder = "C:/Jsp/myapp/WebContent/ch12/filestorage";
String encType = "euc-kr";
int maxSize = 5 * 1024 * 1024;
try {
MultipartRequest multi = null;
multi = new MultipartRequest(request, saveFolder, maxSize,
encType, new DefaultFileRenamePolicy());
Enumeration params = multi.getParameterNames();
while (params.hasMoreElements()) {
String name = (String) params.nextElement();
String value = multi.getParameter(name);
out.println(name + " = " + value + "<br/>");
}
Enumeration files = multi.getFileNames();
while (files.hasMoreElements()) {
String name = (String) files.nextElement();
String filename = multi.getFilesystemName(name);
String original = multi.getOriginalFileName(name);
String type = multi.getContentType(name);
File f = multi.getFile(name);
out.println("파라미터 이름 : " + name + "<br/>");
out.println("실제 파일 이름 : " + original + "<br/>");
out.println("저장된 파일 이름 : " + filename + "<br/>");
out.println("파일 타입 : " + type + "<br/>");
if (f != null) {
out.println("크기 : " + f.length()+"바이트");
out.println("<br/>");
}
}
} catch (IOException ioe) {
System.out.println(ioe);
} catch (Exception ex) {
System.out.println(ex);
}
%>
this is an example code. the problem is very simple. eclipse simply cannot find imports even if the external libraries are stored in WebContent/WEB-INF/lib.
I tried reinstallation, searching on the internet and etc for hours but I still cannot find any solutions for this. I triple,quadra checked import directive. I cannot see any spelling problem
why does this happen to my eclipse?(I am using eclipse oxygen)
解决方案
下载cos.jar
地址:https ://jar-download.com/artifact-search/cos
- 右键构建路径
- 配置构建路径,
- add
cos.jar
添加外部jar
推荐阅读
- ios - 离开左相机时,纹理/游戏对象在右相机上消失
- c - math.h 中的 Round 函数给出了不正确的输出
- javascript - Woocommerce 优惠券管理
- javascript - 过滤器reactjs中的映射
- java - JavaBean 中的 XPages HttpServletResponse 错误
- python - 将arduino与python接口
- java - 为什么 IntelliJ 默认禁用通用用法检查?
- python - Python Bokeh HoverTool 避免显示 NaN
- jquery - 如何查找数据表列值的值并与字符串进行比较?
- sql - 如何在更新语句中更新列的最大值