jsp页面加载bean出问题
---错误提示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: /rectangle.jsp(3,35) quote symbol expected
org.apache.(DefaultErrorHandler.java:41)
org.apache.(ErrorDispatcher.java:407)
org.apache.(ErrorDispatcher.java:88)
org.apache.(Parser.java:222)
org.apache.(Parser.java:162)
org.apache.(Parser.java:153)
org.apache.(Parser.java:953)
org.apache.(Parser.java:1136)
org.apache.(Parser.java:1449)
org.apache.(Parser.java:138)
org.apache.(ParserController.java:239)
org.apache.(ParserController.java:102)
org.apache.(Compiler.java:197)
org.apache.(Compiler.java:372)
org.apache.(Compiler.java:352)
org.apache.(Compiler.java:339)
org.apache.jasper.(JspCompilationContext.java:594)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:344)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.11 logs.
--------------------------------------------------------------------------------
Apache Tomcat/7.0.11
----jsp文件:
<%@ page language="java" contentType="text/html; charset=gb2312"
pageEncoding="gb2312"%>
<jsp:useBean id="rectangle" class=bean.Rectangle scope="page"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>javabean 的实例应用</title>
</head>
<body>
<%
rectangle.setHeigh(4.5);
rectangle.setWidth(5.0);
%>
<div align="center">
<h1> javabean 实例应用</h1>
<p>矩形的长是:<font color="#0000FF"><%=rectangle.getWidth() %></font></p>
<p>矩形的宽是:<font color ="0000FF"><%=rectangle.getHeigh() %></font>
</p>
<p>矩形的周长是:<font color="0000FF"><%=rectangle.getRectangleLength() %></font>
</p>
<p>矩形的面积是:<font color="0000FF"><%=rectangle.getRectangleArea() %></font>
</p>
</div>
</body>
</html>
------bean类
package bean;
public class Rectangle {
private double width;
private double height;
private double rectangleLength;
private double rectangleArea;
public Rectangle(){
this.width=0;
this.height=0;
this.rectangleArea=0;
this.rectangleLength=0;
}
public void setWidth(double d){
this.width=d;
}
public double getWidth(){
return this.width;
}
public void setHeigh(double d){
this.height=d;
}
public double getHeigh(){
return this.height;
}
public double getRectangleLength(){
this.rectangleLength=(this.height+this.width)*2;
return this.rectangleLength;
}
public double getRectangleArea(){
this.rectangleArea=this.height*this.width;
return this.rectangleArea;
}
}