当前位置: 代码迷 >> Java Web开发 >> jsp页面加载bean出问题
  详细解决方案

jsp页面加载bean出问题

热度:291   发布时间:2011-10-13 22:14:24.0
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.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:41)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:88)
    org.apache.jasper.compiler.Parser.parseAttribute(Parser.java:222)
    org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:162)
    org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:153)
    org.apache.jasper.compiler.Parser.parseUseBean(Parser.java:953)
    org.apache.jasper.compiler.Parser.parseStandardAction(Parser.java:1136)
    org.apache.jasper.compiler.Parser.parseElements(Parser.java:1449)
    org.apache.jasper.compiler.Parser.parse(Parser.java:138)
    org.apache.jasper.compiler.ParserController.doParse(ParserController.java:239)
    org.apache.jasper.compiler.ParserController.parse(ParserController.java:102)
    org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:197)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:372)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:352)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:339)
    org.apache.jasper.JspCompilationContext.compile(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.w3.org/TR/html4/loose.dtd">
<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;
    }
   
}
搜索更多相关主题的帖子: expected  页面加载  server  

----------------解决方案--------------------------------------------------------
不知道你什么错,检查rectangle.jsp第三行!是你JSP页面的错误。
----------------解决方案--------------------------------------------------------
jsp页面哪里的问题?请具体点
----------------解决方案--------------------------------------------------------
没家双引号吧,加上试试!
----------------解决方案--------------------------------------------------------
/rectangle.jsp(3,35) quote symbol expected 缺少引号的意思
<jsp:useBean id="rectangle" class=bean.Rectangle scope="page"/> ,class="....."你没加引号
----------------解决方案--------------------------------------------------------
  相关解决方案