我的tomcat以前很好用,近来可让我头大了!

Maker 2003-04-08 12:04:56
我的tomcat以前很好用,近来可让我头大了!
我的tomcat装在win 2000平台上,当我运行一jsp页面时,老是不能编译.class文件!!!不知道怎么办啊!!!

我的这个jsp页面是:
<%@ page import="CartItem" %>

<-- declare two shopping cart items -->
<jsp:useBean id="item0" class="CartItem" scope="session" >
<jsp:setProperty name="item0" property="itemName" value="Carrots" />
<jsp:setProperty name="item0" property="pricePerItem" value=".34" />
</jsp:useBean>

<jsp:useBean id="item1" class="CartItem" scope="session" >
<jsp:setProperty name="item1" property="itemName" value="Red Peppers" />
<jsp:setProperty name="item1" property="pricePerItem" value="2.49" />
</jsp:useBean>

<%-- forward control to the template page --%>
<jsp:forward page="ShoppingCartTemplate.jsp" >
<jsp:param name="header" value="header.html" />
<jsp:param name="tableCaption" value="Produce Purchases" />
<jsp:param name="action" value="ResultPage.jsp" />
<jsp:param name="footer" value="footer.html" />
</jsp:forward>

CartItem.java是:
public class CartItem
{
private int numItems = 0;
private double pricePerItem = 0.0;
private String itemName = null;

public CartItem()
{
}

public void setNumItems(int numItems)
{
this.numItems = numItems;
}

public int getNumItems()
{
return this.numItems;
}

public void setPricePerItem(double pricePerItem)
{

这个文件我编译了,并放在相应的位置。
...全文
6 点赞 收藏 10
写回复
10 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
import 句有问题 : <%@ page import="CartItem" %>
回复
Maker 2003-04-12
我的bean放的位置可以保证是正确的,不知是不是其他的问题?!

因为我以前很好的运行过的,有一次我试着改了conf里的一些配置,就不能正常运行了,后来我重装了tomcat,也不行了,请前辈赐教啊!!!
回复
Maker 2003-04-12
我放在webapps/boot/web-inf/classes下的
回复
kreven 2003-04-08
你的tomcat运行一个成功的例子试试,如果行,就是jsp问题
回复
moumouren 2003-04-08
没有成员itemName的set get方法吧


既然用了<%@ page import="CartItem" %>
为何不直接
<%
item0 = new CartItem();
item0.setNumItems(34);
....
%>
回复
flashroom 2003-04-08
错误提示呢?
回复
wangzhiqing 2003-04-08
没有找到 CartItem类? 这个类你放在什么地方啦?
回复
flashroom 2003-04-08
好象tomcat用bean的时候 bean 一定要放在包里面

你加个包试试
回复
Maker 2003-04-08
错误提示:
HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 3 in the jsp file: /ShoppingCart.jsp

Generated servlet error:
[javac] Compiling 1 source file

D:\tomcat\work\Standalone\localhost\_\ShoppingCart_jsp.java:7: '.' expected
import CartItem;
^
D:\tomcat\work\Standalone\localhost\_\ShoppingCart_jsp.java:44: cannot resolve symbol
symbol : class CartItem
location: class org.apache.jsp.ShoppingCart_jsp
CartItem item0 = null;
^



An error occurred at line: 3 in the jsp file: /ShoppingCart.jsp

Generated servlet error:
D:\tomcat\work\Standalone\localhost\_\ShoppingCart_jsp.java:46: cannot resolve symbol
symbol : class CartItem
location: class org.apache.jsp.ShoppingCart_jsp
item0 = (CartItem) pageContext.getAttribute("item0", PageContext.SESSION_SCOPE);
^



An error occurred at line: 3 in the jsp file: /ShoppingCart.jsp

Generated servlet error:
D:\tomcat\work\Standalone\localhost\_\ShoppingCart_jsp.java:49: cannot resolve symbol
symbol : class CartItem
location: class org.apache.jsp.ShoppingCart_jsp
item0 = (CartItem) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "CartItem");
^



An error occurred at line: 8 in the jsp file: /ShoppingCart.jsp

Generated servlet error:
D:\tomcat\work\Standalone\localhost\_\ShoppingCart_jsp.java:66: cannot resolve symbol
symbol : class CartItem
location: class org.apache.jsp.ShoppingCart_jsp
CartItem item1 = null;
^



An error occurred at line: 8 in the jsp file: /ShoppingCart.jsp

Generated servlet error:
D:\tomcat\work\Standalone\localhost\_\ShoppingCart_jsp.java:68: cannot resolve symbol
symbol : class CartItem
location: class org.apache.jsp.ShoppingCart_jsp
item1 = (CartItem) pageContext.getAttribute("item1", PageContext.SESSION_SCOPE);
^



An error occurred at line: 8 in the jsp file: /ShoppingCart.jsp

Generated servlet error:
D:\tomcat\work\Standalone\localhost\_\ShoppingCart_jsp.java:71: cannot resolve symbol
symbol : class CartItem
location: class org.apache.jsp.ShoppingCart_jsp
item1 = (CartItem) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "CartItem");
^
7 errors


at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:130)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:293)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:340)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:352)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:474)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:184)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:386)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:530)
at java.lang.Thread.run(Thread.java:536)



--------------------------------------------------------------------------------

Apache Tomcat/4.1.18
回复
Maker 2003-04-08
好的,我一定将错误提示附上!
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2003-04-08 12:04
社区公告
暂无公告