1.首先我在D:\apache\Tomcat 5.5下创建一个文件夹lesson
并在server.xml设置好了<Context path="/lesson" docBase="D:\apache\Tomcat 5.5\lesson" />
2.编写了一个类文件放在lesson/WEB-INF/class下面,类为counter.class
内容为
public class counter
{
int count=0;
public counter()
{
}
public int getCount()
{
count++;
return this.count;
}
public void setCount(int count)
{
this.count=count;
}
}
3. 编写index.jsp文件放在lesson下,内容为
<%@ page contentType="text/html;charset=GB2312"%>
<html>
<body>
<jsp:useBean id="bean0" class="counter" scope="application" />
<%out.print(("The count is")+bean0.getCount());%>
</body>
</html>可是运行却提示
An error occurred at line: 5 in the jsp file: /index.jsp
counter cannot be resolved to a type
哪位仁兄帮帮我,急啊..........
并在server.xml设置好了<Context path="/lesson" docBase="D:\apache\Tomcat 5.5\lesson" />
2.编写了一个类文件放在lesson/WEB-INF/class下面,类为counter.class
内容为
public class counter
{
int count=0;
public counter()
{
}
public int getCount()
{
count++;
return this.count;
}
public void setCount(int count)
{
this.count=count;
}
}
3. 编写index.jsp文件放在lesson下,内容为
<%@ page contentType="text/html;charset=GB2312"%>
<html>
<body>
<jsp:useBean id="bean0" class="counter" scope="application" />
<%out.print(("The count is")+bean0.getCount());%>
</body>
</html>可是运行却提示
An error occurred at line: 5 in the jsp file: /index.jsp
counter cannot be resolved to a type
哪位仁兄帮帮我,急啊..........
自学有什么不好,让新手用MyEclipse有什么好,只能又多一个代码工而已。