tailieunhanh - WebSphere Studio Application Developer Version 5 Programming Guide part 32
WebSphere Studio Application Developer part 32 provides integrated development tools for all e-business development roles, including Web developers, Java developers, business analysts, architects, and enterprise programmers. The customizable, targeted, role-based approach of WebSphere Studio Application Developer will be characteristic of all new products built on the WebSphere Studio Workbench. It is well integrated with WebSphere Application Server and provides built-in server test environments that can be used for testing and profiling Web applications | Two classes are generated GetCustomerBeanRow Provides access to one row of the result set. GetCustomerBean Executes the stored procedure and provides a method to retrieve an array of GetCustomerBeanRow objects. Using the JavaBean The generated JavaBean GetCustomerBean can be used in a servlet or JSP to execute the stored procedure and access the result set. A simple JSP to execute the JavaBean is shown in Figure 9-16. The code is available in sg246957 sampcode dev-proc BODY H1 JSP - JavaBean - Stored Procedure H1 jsp useBean id getCustomer class jsp useBean new Integer 106 row 0 TABLE border 1 TR TH align left ID TH TD TD TR TR TH align left Title TH TD TD TR TR TH align left Firstname TH TD TD TR TABLE BODY Figure 9-16 Simple JSP to execute the JavaBean with the stored procedure The GetCustomerBean is instantiated using a useBean tag. The stored procedure is executed and the first row of the result set there is only one is retrieved and displayed. Note that the customer ID is passed as a constant and no error checking is performed. In a real application the code would be more complex. Tip Restart the enterprise application in the server after making changes to the Web application deployment information. 284 WebSphere Studio Application Developer Version 5 Programming Guide Using the JSP tag library Stored procedures can also be executed through the jspsql tag library. See Accessing a database using JSP taglib on page 262 for a description. To make the tag library available for the Web application we have to import the JAR file into the lib directory and add the tag library to the deployment descriptor Select the ItsoProGuideStroedProcWeb Web Content WEB-INF libfolder and Import context . Select File system then locate the directory wsadhome wstools .
đang nạp các trang xem trước