TAILIEUCHUNG - Dynamic Web Pages using JSP - Lab Deliverable 9

Giới thiệu cho Struts 1. Tạo một ứng dụng trống. Sử dụng các ứng dụng trống để tạo ra một trang web hiển thị tiêu đề và tác giả của một cuốn sách. Trang này bao gồm một nút Submit. Sau khi người dùng nhấp chuột vào nút Submit, một trang sẽ xuất hiện chỉ ra rằng yêu cầu đang được xử lý. Ví dụ yêu cầu hai trang JSP và hai JavaBeans. Cập nhật tập tin để liên kết các trang web với JavaBeans | Lab Deliverable 9 Introduction to Struts Part II 1. Create a blank application. Use the blank application to create a Web page that displays the title and author of a book. The page includes a Submit button. After the user clicks the Submit button a page should appear indicating that the request is being processed. The example requires two JSP pages and two JavaBeans. Update file to associate the Web pages with the JavaBeans. Solution The files used in this exercise are 1. 2. 3. 4. @ taglib uri WEB-INF prefix html html head title Struts title head body html form action center b TITLE b html text property title p b AUTHOR b html text property author br p html submit center html form body html Enter the code in Notepad and save the file as in TOMCAT_HOME webapps struts-test. html head title Searching title head body h3 b Searching. b h3 body html Enter the code in Notepad and save the file as searching .jsp in TOMCAT_HOME webapps struts-test. package com import . Introduction to Struts Ver 2005 Aptech Limited 1 import . public class BookForm extends ActionForm private String nTitle null private String nAuthor null public String getTitle return nTitle public void setTitle String aTitle nTitle aTitle public String getAuthor return nAuthor public void setAuthor String aAuthor nAuthor aAuthor public void reset ActionMapping aMapping HttpServletRequest aRequest nTitle null nAuthor null Enter the Java code in Notepad and save the file as BookForm. j ava. Compile the file from the command prompt and copy the class file in TOMCAT_HOME webapps struts-test WEB-INF classes com. package com import . import . import . public class BookAction extends Action public ActionForward perform ActionMapping aMapping ActionForm aForm HttpServletRequest aRequest .

TỪ KHÓA LIÊN QUAN
Đã 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.