新手javaBean问题
始终用不了javaBean,搞了好久,不知道怎么回事,把错误提示贴上来,以及我的源程序贴上来,谢谢谢谢谢谢谢!!!!
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: /a/Counter.jsp (line: 10, column: 59) quote symbol expected
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:408)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:89)
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:242)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:102)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
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.23 logs.
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!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=ISO-8859-1">
<title>show page</title>
</head>
<body bgcolor="#FFFFFF">
<jsp:useBean id="counter" scope="application" class=MyBean.Test/>
<center>time:
<jsp:getProperty name="counter"property="Test"/>
</center>
</body>
</html>
package MyBean;
public class Test {
public Test(){}
private String Name;
private String Password;
public void setName(String name)
{
Name=name;
}
public void setPassword(String password)
{
Password=password;
}
public String showName()
{
return this.Name;
}
public String showPassword()
{
return this.Password;
}
}
我也不知道怎么回事,看书也没有找到
------解决方案--------------------
org.apache.jasper.JasperException: /a/Counter.jsp (line: 10, column: 59) quote symbol expected
提示需要引号啊。
<jsp:useBean id="counter" scope="application" class="MyBean.Test"/>
------解决方案--------------------
+1你忘了加引号了。