<jsp:useBean id="helloworld" scope="page" class="helloworld.class">
jsp页面加这个了吗?
jsp页面加这个了吗?
解决方案 »
- org.apache.poi.hssf.usermodel.HSSFWorkbook cannot be cast to org.apache.poi.ss.u
- try中有return,finally块会不会执行
- 也许是Spring出的事务出问题了
- Struts2的标签问题
- hibernate中约束问题
- jsp传递Color的变量 接收不到,为空
- 使用TOMCAT发布网站,好象是中毒了,总是提示缓存溢出,在WEBAPP下面也多了几个空文件夹。
- 深圳项目外包~~~~
- 谁比较熟悉jsp 可以把qq给我吗?
- 请问j2ee中自带的Application Server比weblogic有什么不同?是否能代替weblogic?
- 大家是不是觉得分太少了啊,再加10
- 程序我们注重思想,数据库我们注重原理.
<!--hellobean.jsp-->
<%@page contentType="text/html;charset=gb2312"%>
<%@page import="javabean.helloworld"%>
<html>
<head>
<title>javabean</title>
</head>
<body>
<center>
<h2><jsp:useBean id="hello" class="helloworld.class" scope="page"/>
<jsp:setProperty name="hello" property="jsp"/>
<jsp:getProperty name="hello" property="welcome"/>
<br>
<%
hello.setWelcome("你好");
out.print(hello.getWelcome());
%>
<br>
</h2>
</center>
</body>
</html>
package javabean;
public class helloworld{
String name;
String welcome;
public helloworld(){
name=null;
welcome="hello world!!";
}
public void setName(String value){
name=value;
}
public String getName(){
return name;
}
public void setWelcome(String value){
welcome=value;
}
public String getWelcome(){
return welcome+name;
}
}
这句话不对,useBean标签不是这样用的,应该是class="包名.类名",即class="javabean.helloworld"。另,@page中的import似乎可以不加。