jsp新手的问题,请各位指点
想学写jsp所以就试试了。但碰到以下问题:
在我的testhello文件夹中有以下内容
WEB-INF(文件夹)--> com(文件夹)--> Hello.class(类文件)
Hello.class(类文件)有以下内容
package com;
public class Hello {
private int showint;
public Hello()
{
this.showint=215;
}
public int getHello()
{
return this.showint;
}
}
=============================================
在testhello文件夹下还有一个index.jsp文件它有以下内容
<%@ page contentType= "text/html; charset=gb2312 " language= "java " import= "java.sql.* "
errorPage= " " %>
<%@ page import= "java.util.* " %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns= "http://www.w3.org/1999/xhtml ">
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 " />
<title> 无标题文档 </title>
</head>
<body>
<jsp:useBean id= "Hel " scope= "page " class= "com.Hello "/>
<%=Hel.getHello()%>
</body>
</html>
我放在tomcat中执行但出错了
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: org.apache.jasper.
JasperException: org.apache.jasper.JasperException: Unable to load class for JSP
org.apache.jasper.servlet.JspServletWrapper.handle
JspException(JspServletWrapper.java:565)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:354)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
请各位指点一下要如何才可以正常运行的
------解决方案--------------------在我的testhello文件夹中有以下内容
WEB-INF(文件夹)--> com(文件夹)--> Hello.class(类文件)
===============================
这里有问题
应该是WEB-INF(文件夹)--> classes(文件夹)--> com(文件夹)--> Hello.class(类文件)
Hello.class(类文件)有以下内容
-=======================
这里也有错,不是Hello.class里有代码内容,而应该是Hello.java里有内容, 然后用javac命令编译Hello.java后得到Hello.class文件,Hello.class的位置如上放
public int getHello() //这里明明是取showint,改为public int getShowint()
{
return this.showint;
}
我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.aiyiweb.com/java-web/317.html