eclipse写了一个类,默认package,编译成功,class文件保存在WEB-INF/classes下,jsp文件保存在工程根目录下,运行的时候时候提示找不到类。
解决方案 »
- eclipse下不能运行下载的javaweb项目
- 想问下java.util.zip是压缩客户端的文件夹还是服务器端的
- 系统上线后遇到个棘手的问题,linux中 socket连接未释放
- JSP 取值
- 如何用jsp来做聊天室?(100分,不够再加)
- 告别2004,提前祝奋战在JAVA战线的兄弟们新年快乐,顺便放点分!(进就有啊!)^_^
- 大家来说说有什么好点的java论坛
- 为什么我的jsp无法找到package呢?
- 散分,给500分
- Jboss下部署EJB的问题。。
- java.sql.SQLException: 结果集已耗尽
- The absolute uri: http://struts.apache.org/tags-bean cannot be resolved in either web.xml or the jar files deployed with this ap
Student cannot be resolved to a type
<head><title>ѧÉúÏêϸÐÅÏ¢</title></head>
<body>
<%@page import="java.util.*"%>
<%! Student stu1,stu2,stu3;
ArrayList arr;
%>
<% stu1=new Student("001","Àî°×","ÄÐ","01",723);
stu2=new Student("002","ÃϺÆÈ»","ÄÐ","02",689);
stu3=new Student("003","ÑîÓñ»·","Å®","05",600);
arr.add(stu1);
arr.add(stu2);
arr.add(stu3);
%>
<table border="1" width="70%" align="center">
<th>
<td>ѧºÅ</td>
<td>ÐÕÃû</td>
<td>ÐÔ±ð</td>
<td>°à¼¶</td>
<td>³É¼¨</td>
</th>
<%
for(int i=0;i<arr.size();i++){
Student stu=(Student)arr[i];
%>
<tr>
<td><%= stu.getID() %></td>
<td><%= stu.getName() %></td>
<td><%= stu.getSex() %></td>
<td><%= stu.getGrade() %></td>
<td><%= stu.getScore() %></td>
</tr>
<% } %>
</table>
</body>
</html>
2、确保class文件保存的位置和包名相对应。
有一事不明,在Student类前加了Package,然后在JSP文件中Import就OK了
那如果用Default Package,JSP文件应该如何Import?