| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1615 人关注过本帖
标题:beans运行出错
取消只看楼主 加入收藏
hongbooboo
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2006-3-18
收藏
 问题点数:0 回复次数:11 
beans运行出错
我的beans 程序是这样的
Circle.java

import java.io.*;
public class Circle
{int radius ;
public Circle()
{radius=1;
}
public int getRadius()
{return radius;
}
public void setRadius(int newRadius)
{radius=newRadius;
}
public double circleArea()
{return Math.PI*radius*radius;
}
public double circleLength()
{return 2.0*Math.PI*radius;
}
}



useBeans.jsp

<%@ page contentType="text/html;charset=GB2312" %>
<%@ page import="Circle" %>
<HTML>
<BODY begcolor=cyan><Font sized=1>
<jsp:useBean id="girl" class="circle" scope="page" >
</jsp:useBean>
<%
girl.setRadius(100);
%>
<p>圆的半径
<%=girl.getRadius() %>
<p>圆的周长
<%=girl.circleLength() %>
<p>圆的面积
<%=girl.circleArea() %>
</BODY>
</HTML>

我的useBeans.jsp放在C:\Tomcat 5.5\webapps\ROOT里
我的Circle.class放在C:\Tomcat 5.5\classes
帮我看看啊,哪里错了啊



搜索更多相关主题的帖子: beans 运行 
2006-03-18 20:42
hongbooboo
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2006-3-18
收藏
得分:0 

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: /useBeans.jsp(5,0) The value for the useBean class attribute circle is invalid.
	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: /useBeans.jsp(5,0) The value for the useBean class attribute circle is invalid.
	org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
	org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
	org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:146)
	org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1174)
	org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116)
	org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
	org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
	org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
	org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
	org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
	org.apache.jasper.compiler.Generator.generate(Generator.java:3304)
	org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
	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.16 logs.


Apache Tomcat/5.5.16


这个是运行的页面,哪里错了啊 

2006-03-18 20:43
hongbooboo
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2006-3-18
收藏
得分:0 
那useBeans.jsp是放在C:\Tomcat 5.5\webapps\ROOT是吗,
还是不行啊


拜托再帮我看看啊

exception

org.apache.jasper.JasperException: /useBeans.jsp(5,0) The value for the useBean class attribute circle is invalid.

root cause

org.apache.jasper.JasperException: /useBeans.jsp(5,0) The value for the useBean class attribute circle is invalid
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.16 logs.




2006-03-19 10:06
hongbooboo
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2006-3-18
收藏
得分:0 
虚拟目录是什么啊
怎么建啊,
我是初学者,不懂啊
2006-03-20 11:24
hongbooboo
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2006-3-18
收藏
得分:0 
恩,我换了一个javabeans的测试程序,结果是能显示的
但是就是这个程序不对,是我从书上看的,
能不能帮我看看这个程序有什么错误啊
那个Circle我改了,可还是不对,拜托啦
<HTML>
<%@ page contentType="text/html;charset=GB2312" %>
<%@ page import="Circle"%>
<HTML>
<BODY bgcolor=cyan><Font size=1>
<jsp:useBean id="girl" scope="page" class="my.Circle" >
</jsp:useBean>
<%
girl.setRadius(100);
%>
<p>圆的半径是:
<%=girl.getRadius() %>
<P>圆的周长是:
<%=girl.circleLength() %>
<p>圆的面积是:
<%=girl.circleArea() %>
</BODY>
</HTML>
2006-03-20 21:25
hongbooboo
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2006-3-18
收藏
得分:0 

package my;
import java.io.*;
public class Circle
{int radius ;
public Circle()
{radius=1;
}
public int getRadius()
{return radius;
}
public void setRadius(int newRadius)
{radius=newRadius;
}
public double circleArea()
{return Math.PI*radius*radius;
}
public double circleLength()
{return 2.0*Math.PI*radius;
}

}

2006-03-20 21:27
hongbooboo
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2006-3-18
收藏
得分:0 

啊啊啊,真的,我把这句
<%@ page import="Circle"%>
去掉后能运行出来了啊,
太感谢了啊

2006-03-20 22:38
hongbooboo
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2006-3-18
收藏
得分:0 
我想做个留言板,应该怎么开始啊,给我点意见啊
2006-03-20 22:43
hongbooboo
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2006-3-18
收藏
得分:0 
我在做用户注册的时候,beans里出现错误
String condition="INSERT INTO member VALUES"+"("+S+")";说找不到符号
这个句子是向数据中的member表添加记录,这样有什么不对吗
2006-03-22 20:19
hongbooboo
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2006-3-18
收藏
得分:0 
能说详细点吗,我怎么改也改不出来啊,这个是我的程序:

这个是注册的beans
package my;
import java.sql.*;
public class Register
{String logname="",
password="",
sex="",age="",
email="",
phone="",
address="",
message="";
String backNews;
Connection con;
Statement sql;
ResultSet rs;
public Register()
{try{Class.forName("sun.jdbc.odbc.jdbcodbcDriver");}
catch(ClassNotFoundException e){}
}
public void setLogname(String name)
{logname=name;
}
public String getLogname()
{return logname;
}
public void setAge(String n)
{age=n;
}
public String getAge()
{return age;
}
public void setSex(String s)
{sex=s;
}
public String getSex()
{return sex;
}
public void setPassword(String pw)
{password=pw;
}
public String getPassword()
{return password;
}
public void setEmail(String em)
{email=em;
}
public String getEmail()
{return email;
}
public void setPhone(String ph)
{phone=ph;
}
public String getPhone()
{return phone;
}
public void setAddress(String ad)
{address=ad;
}
public String getAddress()
{return address;
}
public String getMessage()
{return message;
}
public void setMessage(String m)
{message=m;
}
public String getBackNews()
{return backNews;
}
public void setBackNews(String s)
{backNews=s;
}
public void addItem()
{try{
Connection con=DriverManager.getConnection("jdbc:odbc:friend","","");
sql=con.createStatement();
if(phone.length()==0)
{phone="wu";
}
if(email.length()==0)
{email="wu"; }
if(address.length()==0)
{address="wu"; }
if(message.length()==0)
{message="wu"; }
String s=
"'"+logname+"'"+","+"'"+password+"'"+","+"'"+sex+"'"+","+
"'"+age+"'"+","+"'"+phone+"'"+","+"'"+email+"'"+","+
"'"+address+"'"+"'"+"'"+message+"'";
String condition="INSERT INTO member VALUES"+"("+S+")";
sql.executeUpdate(condition);
backNews="zhuce chenggong";
con.close();
}
catch(SQLException e)
{backNews="ni hai mei zhu ce ,qi huan mingzi ";
}
}
}


但是编译不行啊,说是String condition="INSERT INTO member VALUES"+"("+S+")";   找不到符号
这是什么原因啊,帮我看看啊

2006-03-23 09:41
快速回复:beans运行出错
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.029078 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved