Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 235 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
235
Dung lượng
15,94 MB
Nội dung
[...]... must take a look at what a bean is A JavaBean is a 100% Java component that works on any Java Virtual Machine The minimum requirements that make a component a JavaBean are as follows: It must support the JDK 1.1 and later Serialization model It must use get/set accessors to expose its properties There is nothing magical about creating a JavaBean You just create aJava class that implements the java. io.Serializable... following: The newBean's simpleProperty == simple property value Press enter to continue Chapter 3: JavaBeans and JSP Concepts Overview Before we can start learning about how you can use JavaBeans in JavaServer Pages, we must take a look at what a bean is A JavaBean is a 100% Java component that works on any Java Virtual Machine The minimum requirements that make a component a JavaBean are as follows: It... Pages In the following sections, we are going to look at the standard actions used to reference JavaBeans and an example that uses these actions JavaBean Standard Actions There are three standard actions defined to help integrate JavaBeans into JSPs: , , and The first standard action is It associates an instance of a JavaBean... 1.1 and later Serialization model It must use get/set accessors to expose its properties There is nothing magical about creating a JavaBean You just create aJava class that implements the java. io.Serializable interface and uses public get/set methods to expose its properties Listing 3.1 contains a simple JavaBean Listing 3.1: SimpleJavaBean .java import java. io.Serializable; public class SimpleJavaBean... , , and the actions The syntax of the action is as follows: < /jsp: params> Table 1.5 contains the attributes and their descriptions for the action Table 1.5: The Attributes for the Action Attribute name Definition This attribute represents the name of the parameter being referenced... 3.2 creates an instance of our SimpleJavaBean, sets the simpleProperty to "simple property value", serializes the bean to a file, reads the bean back in, and finally displays proof that its state was maintained Listing 3.2: SimpleJavaBeanTester .java import java. io.*; public class SimpleJavaBeanTester { public SimpleJavaBeanTester() { } public void storeBean(SimpleJavaBean value) { try { // Create the... These are just a few examples of the power and practicality of using Java servlets Servlets are a very viable option for most Web applications - 17 - The Java Servlet Architecture Two packages make up the servlet architecture: the javax.servlet and javax.servlet.http packages The javax.servlet package contains the generic interfaces and classes that are implemented and extended by all servlets The javax.servlet.http... In Chapter 2, "Java Servlets," we are going to cover Java servlets Then in Chapter 3, "JavaBeans and JSP Concepts," we'll look at JavaBeans and how they can be used in JSPs Chapter 2: Java Servlets Overview JavaServer Pages are extensions of Java servlets, therefore, you really need to understand Java servlets before you can fully grasp the JSP architecture Given the previous statement, servlets are... information to use as we progress in the study of JSPs In Chapter 3, "JavaBeans and JSP Concepts," we begin to really take a look at the JavaServer Pages technology Some of the topics we will cover include JSP application models, syntax, semantics, scripting, and directives Chapter 3: JavaBeans and JSP Concepts Overview Before we can start learning about how you can use JavaBeans in JavaServer Pages,... value) { simpleProperty = value; } } This class is now a JavaBean It satisfies the minimum requirements You can now load the SimpleJavaBean into any JavaBeans–aware program that uses introspection and change its properties Its state can then be saved and reloaded anytime, because of its support for serialization Let's take a look at an example that illustrates how to serialize our new bean The example . sending JavaMail, and much more. The final third of the book is a syntax reference for the javax.servlet .jsp, javax.servlet .jsp. tagext, javax.servlet.package, and javax.servlet.http packages. A. Components of a JavaServer Page Chapter 2: Java Servlets Chapter 3: JavaBeans and JSP Concepts Chapter 4: JDBC and JSP Concepts Chapter 1: JSP Overview: The Components of a JavaServer Page Overview. the Java servlet framework. Chapter 3, "JavaBeans and JSP Concepts" Chapter 3 covers the basics of JavaBeans. It takes a look at the standard actions involved in embedding a bean