当前位置: 技术问答>java相关
为什么会这样? Unable to compile class for JSP
来源: 互联网 发布时间:2017-03-31
本文导语: jsp.jsp: SimpleBean.java: import java.io.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.ServletInputStream; public class SimpleBean { public void doUpload(HttpServletRequest reques...
jsp.jsp:
SimpleBean.java:
import java.io.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletInputStream;
public class SimpleBean {
public void doUpload(HttpServletRequest request) throws
IOException {
PrintWriter pw = new PrintWriter(
new BufferedWriter(new FileWriter("Demo.out")));
ServletInputStream in = request.getInputStream();
int i = in.read();
while (i != -1) {
pw.print((char) i);
i = in.read();
}
pw.close();
}
}
jsp放在examples/jsp下,class放在examplesWEB-INFclasses下
运行jsp出错:
An error occurred at line: 1 in the jsp file: /jsp/jsp.jsp
Generated servlet error:
D:JBuilder7jakarta-tomcat-4.0.3worklocalhostexamplesjspjsp$jsp.java:56: Class org.apache.jsp.SimpleBean not found.
SimpleBean TheBean = null;
^
An error occurred at line: 1 in the jsp file: /jsp/jsp.jsp
Generated servlet error:
D:JBuilder7jakarta-tomcat-4.0.3worklocalhostexamplesjspjsp$jsp.java:59: Class org.apache.jsp.SimpleBean not found.
TheBean= (SimpleBean)
^
An error occurred at line: 1 in the jsp file: /jsp/jsp.jsp
Generated servlet error:
D:JBuilder7jakarta-tomcat-4.0.3worklocalhostexamplesjspjsp$jsp.java:64: Class org.apache.jsp.SimpleBean not found.
TheBean = (SimpleBean) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "SimpleBean");
SimpleBean.java:
import java.io.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletInputStream;
public class SimpleBean {
public void doUpload(HttpServletRequest request) throws
IOException {
PrintWriter pw = new PrintWriter(
new BufferedWriter(new FileWriter("Demo.out")));
ServletInputStream in = request.getInputStream();
int i = in.read();
while (i != -1) {
pw.print((char) i);
i = in.read();
}
pw.close();
}
}
jsp放在examples/jsp下,class放在examplesWEB-INFclasses下
运行jsp出错:
An error occurred at line: 1 in the jsp file: /jsp/jsp.jsp
Generated servlet error:
D:JBuilder7jakarta-tomcat-4.0.3worklocalhostexamplesjspjsp$jsp.java:56: Class org.apache.jsp.SimpleBean not found.
SimpleBean TheBean = null;
^
An error occurred at line: 1 in the jsp file: /jsp/jsp.jsp
Generated servlet error:
D:JBuilder7jakarta-tomcat-4.0.3worklocalhostexamplesjspjsp$jsp.java:59: Class org.apache.jsp.SimpleBean not found.
TheBean= (SimpleBean)
^
An error occurred at line: 1 in the jsp file: /jsp/jsp.jsp
Generated servlet error:
D:JBuilder7jakarta-tomcat-4.0.3worklocalhostexamplesjspjsp$jsp.java:64: Class org.apache.jsp.SimpleBean not found.
TheBean = (SimpleBean) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "SimpleBean");
|
这是你的设置的问题
你可以再看看tomcat的设置
要不你要麻烦的话就用jbuilder吧
你可以再看看tomcat的设置
要不你要麻烦的话就用jbuilder吧
|
不能把jsp编译成class文件,用resin试试.
|
重新启动Tomcat
|
你把你的web-inf/classes加到classpath里去看一看