TAILIEUCHUNG - Java Server Pages: A Code-Intensive Premium Reference- P12

Java Server Pages: A Code-Intensive Premium Reference- P12:Before you begin reading Pure JSP Java Server Pages, you might want to take a look at its basic structure. This should help you outline your reading plan if you choose not to read the text from cover to cover. This introduction gives you an overview of what each chapter covers. | center body html You can see that the only difference between these two JSPs is the values of the HTML title and h3 tags. To see how a session bean works copy both of these JSPs to the SERVER_ROOT purejsp directory and open your browser to the following URL http yourserver 8080 purejsp You should see an image similar to Figure . Go ahead and hit your reload button several times. You should see the count increase each time the page is reloaded. Now use the same browser instance to open the following URL http yoi. rserver 8080 purejsp You will see the count increment from the last count from the first JSP. This is because the Counter bean is stored in the session of the client. Now open a completely new instance of the browser and you will see the value of the count property is reset. This is because each instance of a client creates its own instance of the HttpSession which is where the Counter bean is stored. Figure The output from . application Beans with application scope are accessible within pages processing requests that are in the same application space as the page in which they were created. References to the object will be released when the runtime environment reclaims the ServletContext. More simply put this means that until the JSP engine is restarted the bean created with application scope will be available. Beans with application scope are best used when you need to share information between JSPs and servlets for the life of your application. To give an example of application scope we are going to use two JSPs. The first will load the Counter bean using an id of counter and a scope of application. It will then print out the current value of the Counter bean using the method. Listing contains the source for our first JSP. Listing @ page errorPage- -- Instantiate the Counter bean with an id of counter -- - 111 - jsp .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.