请教各位大侠一个JavaBean的问题

04-03-28 kinematic

俺在JSP中调用bean,开头声明如下

<jsp:useBean id="cart" class="com.wxstudio.test.CartBean" scope="session"/>

<jsp:setProperty name="cart" property="*"/>

后面调用一个方法:cart.addItem( id, desc, price, 1);

源程序开头已声明package com.wxstudio.test;

并且将编译好的CartBean.class存在D:\beans\com\wxstudio\test目录下,然后在

D:\beans下压缩为CartBean.jar,并且在系统环境变量classpath中也设置了D:\beans\

CartBean.jar,可是运行JSP文件时报错:

exception

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

An error occurred at line: 3 in the jsp file: /bhp/ch21/addCart.jsp

Generated servlet error:

[javac] Compiling 1 source file

D:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\_\bhp\ch21\addCart_jsp.java:62: cannot resolve symbol

symbol : class CartBean

location: package test

com.wxstudio.test.CartBean cart = null;

^

显示找不到bean,还请各位大侠救命,小弟叩谢。

kinematic
2004-03-28 11:43

不好意思,刚才没贴上,开头声明如下:

<jsp:useBean id="cart" class="com.wxstudio.test.CartBean" scope="session"/>
<jsp:setProperty name="cart" property="*"/>
<p>

airport
2004-03-28 14:13

你放到WEB-INF的lib里面就是了!

TheOne2004
2004-03-28 16:37

你不知道BEAN要放在什么目录吗?