In your JSP virtual directory, a CLASS folder is created, and then build a BeginJavabean folder under the Classes folder, and build a file in this folder is as follows: package beginjavabean; public class hellobean {private string HelloStr = "Hello everyone, welcome to learn Javabean!";
Public hellobean () {}
/ *** Get hellostr * / public string getHellostr () {return this.hellostr;}
/ *** I heard the beginning of learning Javabean, everyone applauded! * / public string applause () {return "good ... good ... !!!";}} Compile it to Hellobean.class to build a hellobean.jsp file in your JSP virtual directory, the content is as follows: < % @ page language = "java" contenttype = "text / html; charset = GBK"%> <% @ page import = "java.util. *"%> <% @ page import = "java.text. *"% >
Hello everyone, welcome to learn Javabean! Good ... good ...! ! !
Current time: January 19, 2005 07:17 seconds
Congratulations, you will also javabean!