Indexed属性的问题

chengsetianxie 2006-03-14 07:51:55
package Board;
import java.util.StringTokenizer;

public class Board
{
private String[][] board = new String[4][4];

public Board()
{
for(int row=1;row<=3;row++)
{
for(int col=1;col<=3;col++)
{
board[row][col] = "";
}
}
}

public void setBoard(String marks)
{
StringTokenizer tokenizer = new StringTokenizer(marks,",");
System.out.println(marks);
for(int row=1; row<3; row++)
{
for(int col=1; col<=3; col++)
{
board[row][col] = tokenizer.nextToken();
System.out.println(board[row][col]);
}
}
}

public String getBoard(int row,int col)
{
return board[row][col];
}
}

///////////调用
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page import="Board.Board" %>
<!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>无标题文档</title>
</head>
<body>
<jsp:useBean id="boradbean" class="Board.Board" />

<% String marks = "X,X,0,X,0,0,0,0,0"; %>
<jsp:setProperty name="boardbean" property="board" value="<%=marks%>" />

<% showBoard(boardbean,out); %>

<%!
public void showBoard(Board boardbean, JspWriter out)
throws java.io.IOException
{
for(int row=1; row<=3; row++)
{
for(int col=1; col<=3; col++)
{
out.println(boardbean.getBoard(row,col));
out.println("<br>");
}
}
out.println("<br>");
}
%>
</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: Unable to compile class for JSP

Generated servlet error:
The import Board cannot be resolved

An error occurred at line: 17 in the jsp file: /haha.jsp
Generated servlet error:
Board cannot be resolved to a type

An error occurred at line: 10 in the jsp file: /haha.jsp
Generated servlet error:
Board cannot be resolved to a type

An error occurred at line: 10 in the jsp file: /haha.jsp
Generated servlet error:
Board cannot be resolved

An error occurred at line: 10 in the jsp file: /haha.jsp
Generated servlet error:
Board cannot be resolved to a type

An error occurred at line: 15 in the jsp file: /haha.jsp
Generated servlet error:
boardbean cannot be resolved


org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

org.apache.jasper.JasperException: Unable to compile class for JSP

Generated servlet error:
The import Board cannot be resolved

An error occurred at line: 17 in the jsp file: /haha.jsp
Generated servlet error:
Board cannot be resolved to a type

An error occurred at line: 10 in the jsp file: /haha.jsp
Generated servlet error:
Board cannot be resolved to a type

An error occurred at line: 10 in the jsp file: /haha.jsp
Generated servlet error:
Board cannot be resolved

An error occurred at line: 10 in the jsp file: /haha.jsp
Generated servlet error:
Board cannot be resolved to a type

An error occurred at line: 15 in the jsp file: /haha.jsp
Generated servlet error:
boardbean cannot be resolved


org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:409)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:297)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.15 logs.


--------------------------------------------------------------------------------

Apache Tomcat/5.5.15
...全文
60 点赞 收藏 2
写回复
2 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
yingtju 2006-03-15
编译Board,放在classpath下
回复
usherlight 2006-03-15
出错提示很清楚, 没有引入Board包, 所有不认识Board类.

在jsp最前面加上
<%@ page import="Board.*"%>
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2006-03-14 07:51
社区公告
暂无公告