<jsp:useBean id="card" scope="session" class="untitled1.card"/>
解决方案 »
- 求助:实现写 文章 的问题!!!看看吧,感激不尽!
- JSP网站如何在服务器启动时使一个类运行,并确保这个类只有一个实例在运行
- 想学习一种标签替换脚本
- 关于Vista上播放声音的问题
- 取SQLServer中text型数据的问题
- servlet可以通过url传参数吗?
- 当WEB后台程序执行比较费时的操作时,该如何处理
- MapBasic v6.0 1CD(在MapInfo平台上开发用户定制的应用程序的编程语言)
- 一个设计模式的问题,大家帮我提点意见。
- 求助,struts2利用POI导出excel
- 我用j2ee开发一个企业网站,公司说要买正版软件,您说我该报些什么软件让他们买?
- jsp的表格中显示2不同图片结果都变成了同一幅图片,不知是哪里有问题,附代码
呵呵!
要简单BEAN程序你就写个HELLOO WORD吧!如果你看了JAVA基础,你就会写。
sample.jsp
<%@page contentType="text/html;charset=GBK"%>
<html>
<head>
<title>
sample1
</title>
</head>
<jsp:useBean id="Sample1BeanId" scope="session" class="javabean.sample1Bean"/>
<jsp:setProperty name="Sample1BeanId" property="*" />
<body>
<h1>
A JSP & Bean Sample
</h1>
<form method="post"><br>
Enter new value : <input name="sample"><br>
<input type="submit" name="Submit" value="Submit">
<input type="reset" value="Reset"><br>
Value of Bean property is : <jsp:getProperty name="Sample1BeanId" property="sample"/>
</form></body>
</html>sample1Bean.java
package javabean;public class sample1Bean {
private String sample = "Start value";
public String getSample(){
return this.sample;
}
public void setSample(String newValue){
if(newValue != null){
this.sample = newValue;
}
}
}Hint:
remember
1.compile and put:
bean=>sample1Bean.java
with in=>TOMCAT_INSTALL_HOME\webapps\newproject\WEB-INF\classes\javabean\sample1Bean.class
2.put:
jsp=>sample.jsp
with in:TOMCAT_INSTALL_HOME\webapps\newproject\WEB-INF\sample.jsp
Good Luck!!!
RUN: http://localhost:8080/newproject/sample.jsp