javabean例子出错 望指点~
本人刚学习javabean 写了个小程序
BeanTest。java:
package olympics;
public class BeanTest {
String name;
public BeanTest(){}
public void setName(String value)
{name=value;}
public String getName()
{return name;}
}
useBeanEx。jsp:
<html>
<%@page contentType= "text/html ";charset=gb2312 %>
<%@page import= "olympics.* " %>
<head> <title> useBean.jsp </title> </head>
<body>
<%
BeanTest test=new BeanTest();
test.setName( "WANG ");
%>
<%=test.getName() %>
</body>
</html>
觉得没有错误可是报错一直,代码如下:
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: /WebRoot/useBeanEx.jsp(2,0) Unterminated <%@ page tag
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:132)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:504)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1426)
org.apache.jasper.compiler.Parser.parse(Parser.java:133)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:215)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:102)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:167)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:306)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:308)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.10 logs.
--------------------------------------------
Apache Tomcat/6.0.10
------解决方案--------------------她说你JSP第2行写错了,应该是要空格的
------解决方案-------------------- <%@page contentType= "text/html ";charset=gb2312 %>
<%@page import= "olympics.* " %>
<html>
<head> <title> useBean.jsp </title> </head>
<body>
<%
BeanTest test=new BeanTest();
test.setName( "WANG ");
%>
<%=test.getName() %>
</body>
</html>
请这样写!!!!
------解决方案--------------------