smplBean.java里,最上面加上:
package Bean;
package Bean;
解决方案 »
- 一条sql语句在mysql中执行报错
- 为什么启动tomcat会调用ServletContextAttributeListener的attributeAdded方法等?
- java.lang.ClassNotFoundException: org.apache.struts.action.ActionServlet
- 请教:怎样在JSP页面添加一个按钮,实现保存当前页面图片的效果。
- 求JSP<s:text>或<s:textfield>的宽和高的设置!!
- jsp重定向问题
- 怎么样在jsp里获取当前时间是当年的第几周
- java.sql.Date
- 如何实现web打印功能
- 怎样提交一个表单调用一个Servlet?
- 第一个里程碑!
- 看了能得分的简单问题。about jsp session
试过了,还是不行啊,我的文件如下:
//firstBean.java
package Bean;
public class smplBean
{
private String sample="Start value"; public String getSample()
{
return sample;
} public void setSample(String newValue)
{
if (newValue!=null)
{
sample=newValue;
}
}
}
//firstBean.jsp
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ page contentType="text/html;charset=GBK" %>
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<jsp:useBean id="beanId" scope="session" class="Bean.smplBean"/>
<jsp:setProperty name="beanId" property="*"/><body>
<h1>
A JSP&Bean Sample
</h1>
<form method="post" >
<br>Enter new value :<input name="sample"><br>
<br><br>
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="reset" value="Reset">
<br>
Value of Bean property is :<jsp:getProperty name="beanId" property="sample"/></form>
</body>
</html>
难道真是万事开头难吗?
如果是jar拷到\Tomcat\shared\lib试试看