急急急!!!!!!!!!!!!!刚接触JSP,遇到一些麻烦,请教高手!!1

sph19821101 2005-04-20 04:23:05
情高手指教:我的程序到底错在哪里了啊
由于刚接触JSP,还望高手不吝赐教:
代码如下:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<jsp:useBean id="calculator" scope="request" class="com.jspdev.ch5.SimpleCalculator">
<jsp:setProperty name="calculator" property="*"/>
</jsp:useBean>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<hr>
计算结果:<%
try
{

calculator.calculate();
out.println(calculator.getFirst()+calculator.getOperator()+calculator.getSecond()+"="+calculator.getResult());
}
catch(Exception e)
{
out.println(e.getMessage());
}
%>
<hr>
<form action="calculate.jsp" method=get>
<table width="75%" border="1" bordercolor="#003300">
<tr bgcolor="#999999">
<td colspan="2">简单的计数器</td>
</tr>
<tr>
<td>第一个参数</td>
<td><input type=text name="first"></td>
</tr>
<tr>
<td>操作符</td>
<td><select name="operator">
<option value="+">+</option>
<option value="-">-</option>
<option value="*">*</option>
<option value="/">/</option>
</select>
</td>
</tr>
<tr>
<td>第二个参数</td>
<td><input type=text name="second"></td>
</tr>
<tr>
<td colspan="2" bgcolor="#CCCCCC"><input type=submit value=计算></td>
</tr>
</table>
</form>
</body>
</html>
错误提示:
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: 1 in the jsp file: /ch5/calculate.jsp

Generated servlet error:
[javac] Compiling 1 source file

D:\jakarta-tomcat-4.1.30\work\Standalone\localhost\_\ch5\calculate_jsp.java:43: package com.jspdev.ch5 does not exist
com.jspdev.ch5.SimpleCalculator calculator = null;
^



An error occurred at line: 1 in the jsp file: /ch5/calculate.jsp

Generated servlet error:
D:\jakarta-tomcat-4.1.30\work\Standalone\localhost\_\ch5\calculate_jsp.java:45: package com.jspdev.ch5 does not exist
calculator = (com.jspdev.ch5.SimpleCalculator) pageContext.getAttribute("calculator", PageContext.REQUEST_SCOPE);
^



An error occurred at line: 1 in the jsp file: /ch5/calculate.jsp

Generated servlet error:
D:\jakarta-tomcat-4.1.30\work\Standalone\localhost\_\ch5\calculate_jsp.java:48: package com.jspdev.ch5 does not exist
calculator = (com.jspdev.ch5.SimpleCalculator) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "com.jspdev.ch5.SimpleCalculator");
^
3 errors
小弟在此先谢过啦
...全文
106 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
pxsaner 2005-04-21
  • 打赏
  • 举报
回复
.class文件放在\WEB-INF\com\jspdev\ch5\下。
重起服务器
fashchina 2005-04-20
  • 打赏
  • 举报
回复
提示就是说没放对
purplegabriel 2005-04-20
  • 打赏
  • 举报
回复
pack包好象也没有放对地方
sph19821101 2005-04-20
  • 打赏
  • 举报
回复
我的.class文件本来就是放在com.jspdev.ch5下的啊.
thebestzhao 2005-04-20
  • 打赏
  • 举报
回复
你的Bean放的路径不对,把.class文件放到com.jspdev.ch5下.
MARS.nEIL 2005-04-20
  • 打赏
  • 举报
回复
SimpleCalculator.class文件放在 com/jspdev/ch5目录下.

81,122

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧