import counter.*;
如果不是贴原码
如果不是贴原码
解决方案 »
- hibernate 修改主表,不想删除附表数据
- 新人散分求指导,jsp/servlet文件上传。
- 使用jfreechart画柱状图,怎么在横轴的每个日期里显示汉字?
- 急! 一个JavaBean 的问题
- struts跳转错误:Path tran.jsp does not start with a "/" character
- 求助,高手进!关于JSP乱码问题
- 注册代码问题
- 请问在web.xml中,如何配置Filter?
- 开发中的发版本是什么意思? 毕业生
- 怎样让Frame类创建的窗口的最大化按钮失效?
- 请问怎样实现此效果:从一个页面上点击按钮后,弹出另一页面;然后弹出的页面关了后才能激活前面的主页面。谢谢!!
- 在servlet中使用session时,如何不使用cookie而使用URL rewriting?
解决方法:在jsp文件中加入import counter;
然后重新编译该文件。
<%@ page language="java" import="counter"%>
<!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<title>Lomboz JSP</title>
</head>
<body bgcolor="#FFFFFF">
<jsp:useBean id="bean0" scope="application" class="counter" />
<%
out.println("<center>你是第<font color='red'>"+bean0.getCount()+"</font>个访问该页面</center><br>");%></body>
</html>
你们说怎么该啊
/*
* Created on 2004-3-19
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*//**
* @author xiaoma
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class counter {
int count=0;
public counter(){
}
public int getCount(){
count++;
return this.count;
}
public void setCount(int count){
this.count=count;
}}
<jsp:useBean id="bean0" scope="application" class="counter" />说明:
1.类没有定义包名时,一定要先导入类,再声明类的实例. 2.类有定义包名时,可以直接使用类的全包名声明实例.如:
<jsp:useBean id="tools" scope="application" class="com.yaray.tool.Tools" />
<jsp:useBean id="bean0" scope="application" class="counter" />