在tomcat的文件目录下的根目录的webapps\ROOT\WEB-INF下没有classes文件夹,我新建了一个classes文件夹,然后在新建自己的要用的.class文件如:chatroom\online.class.但是编译的时候提示说:The value for the useBean class attribute chatroom.online is invalid.怎么回事啊?搞不懂,知道的快点告诉我啊,急啊!
解决方案 »
- socket开发发生问题,通过我本地的给服务器发送一句话,然后服务器返回后进行操作
- 谁给我个好的例子(xml文件生成jsp)或怎么实现方法,我700分全给他,在线等了!!
- mysql 排序问题
- 哪位大大有jspsmartupload的jar包啊?给小弟传一个,在此跪谢了!
- 请问怎么判断一个字符串是否为null??
- jsp中的数据库连接问题(在线等)
- 我原来是用statement来实现sql语句的插入的,现在改用preparedstatement结果所有的中文全部变成了乱码,原来用statement的时候还没有这个
- 在jsp中可以用ssl连接么?
- java应用程序如何调用javabean组件啊?
- 页面经tomcat后显示不正常
- 请教,如何在程序中调用其他的类?
- table 与text的嵌 问题 急求 会的进
把你的useBean 代码贴上来看看!
package chatroom;
import java.util.*;
import java.sql.*;
public class conn{
String dbDriver="com.mysql.jdbc.Driver";
String dbName="jdbc:mysql://localhost:3306/chat";
ResultSet rs=null;
Connection conn=null;
Statement stmt=null;
public conn(){
try{
Class.forName("dbDriver");
}
catch(ClassNotFoundException e1){
System.err.println("Class not found!"+e1.getMessage());
}
try{
conn=DriverManager.getConnection(dbName);
}
catch(SQLException e2){
System.err.print(e2);
}
}
public ResultSet executeQuery(String sql){
rs=null;
try{
conn=DriverManager.getConnection(dbName,"root","root");
stmt=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
rs=stmt.executeQuery(sql);
}catch(SQLException e3){
System.err.print(e3);
}
return rs;
}public int excuteUpdate(String sql){
int rt=0;
try{
conn=DriverManager.getConnection(dbName,"root","root");
stmt=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
rt=stmt.executeUpdate(sql);
}catch(SQLException e4){
System.err.print(e4);
}
return rt;
}public void close(){
try{
if(conn!=null)
conn.close();
}catch(Exception e){
System.out.print(e);
}try{
if(rs!=null)
rs.close();
}catch(Exception e){
System.out.println(e);
}
}}
public class online
{
private String uName[];
private String uNickName[];
private String uSex[];
public String room;
private int total;
public online()
{
uName=new String[50];
uNickName=new String[50];
uSex=new String[50];
room=null;
total=0;
}
public void add(String UserName,String NickName,String Sex)
{
if(total<50)
{
uName[total]=UserName;
uNickName[total]=NickName;
uSex[total]=Sex;
total++;
}
}
public void delete(String UserName)
{
for(int i=0;i<total;i++)
if(uName[i].equals(UserName))
{
for(int j=i;j<total-1;j++)
{
uName[j]=uName[j+1];
uNickName[j]=uNickName[j+1];
uSex[j]=uSex[j+1];
}
total--;
}
}
public int find(String UserName)
{
for(int i=0;i<total;i++)
{
if(uName[i].equals(UserName))
return(i+1);
if(i==(total-1))
return 0;
}
return 0;
}
public String getuName(int num)
{
if(num<50)
return uName[num];
return null;
}
public String getuNickName(int num)
{
if(num<50)
return uNickName[num];
return null;
}
public String getuSex(int num)
{
if(num<50)
return uSex[num];
return null;
}
public int gettotal()
{
return total;
}
public String getroom()
{
return room;
}
public void setroom(String str)
{
this.room=str;
}
}
把你的useBean 代码贴上来看看!我没说清楚,我是要你的jsp里面的useBean代码,就是
<jsp:useBean 的这一行
<jsp:useBean id="online" class="chatroom.online" scope="application"/>
<jsp:useBean id="online" class="chatroom.online" scope="application"/>