ImageVerifierCode 换一换
格式:DOCX , 页数:22 ,大小:387.61KB ,
资源ID:19522724      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/19522724.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(lab4Creating a Simple Web Application Using a MySQL DatabaseWord文档下载推荐.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

lab4Creating a Simple Web Application Using a MySQL DatabaseWord文档下载推荐.docx

1、o Adding JSP and JSTL Code Deploying and Running the Project See Also To follow this tutorial, you need the following software and resources.Software or ResourceVersion RequiredNetBeans IDEWeb and Java EE installationversion 6.0Java Developer Kit (JDK)version 6 or version 5MySQL database serverversi

2、on 5.xMySQL Connector/J JDBC DriverGlassFish application server or Tomcat servlet containerV2 version 6.xNotes: The NetBeans IDE 6.1 with Glassfish and MySQL Bundle Download provides you with an all-in-one package of software required for this tutorial. The Web and Java EE installation enables you t

3、o optionally install the GlassFish V2 application server and the Apache Tomcat servlet container 6.0.x. You must install one of these to work through this tutorial. The MySQL Connector/J JDBC Driver, necessary for communication between Java platforms and the MySQL database protocol, is included in N

4、etBeans IDE 6.x. If you need to compare your project with a working solution, you can download the sample application. Planning the StructureSimple web applications can be designed using a two-tier architecture, in which the application communicates directly with a data source using the Java Databas

5、e Connectivity API. A users requests are sent to a database, and the results are sent directly back to the user. Two-tier architectures can be easily mapped to a client-server configuration, where a users browser serves as the client, and a remote database reachable over the Internet corresponds to

6、the server.The application you build in this tutorial involves the creation of two JavaServer Pages. In each of these pages, you add basic HTML to implement a simple interface, followed by SQL tags provided by JSTL technology in order to query the database. Consider the following client-server scena

7、rio:The welcome page (index.jsp) presents the user with a simple HTML form. When a client requests the index.jsp page, the JSP code contained therein is parsed, and data from the Subject database table is gathered, added to the page, and sent to the client. The user makes a selection in the provided

8、 HTML form and submits, which causes the client to make a request for response.jsp. When response.jsp is parsed, data from both the Subject and Counselor tables is gathered and inserted into the page. Finally, the page is returned to the client and the user views data based upon his or her selection

9、.Creating a New ProjectIn order to implement the scenario described above, you develop a simple application for a fictitious organization named IFPWAFCAD, or The International Former Professional Wrestlers Association for Counseling and Development. The application enables a user to choose a counsel

10、ing subject from a drop-down list (index.jsp), then retrieves data from the MySQL database and returns the information to the user (response.jsp):index.jspresponse.jspCreate a new project in the IDE:1. Start NetBeans IDE and choose File New Project (Ctrl-Shift-N) from the main menu. Under Categories

11、 select Web; under Projects select Web Application. Click Next. 2. In Project Name, enter IFPWAFCAD. From the Server drop-down list, select the server you plan work with. Leave all other settings at their defaults and click Finish. The IDE creates a project template for the entire application, and o

12、pens an empty JSP page (index.jsp) in the Source Editor. index.jsp serves as the entry point for the application. The new project is structured according to Sun Java BluePrints guidelines. Preparing the InterfaceBegin by preparing a simple interface for the two pages. Both index.jsp and response.jsp

13、 implement an HTML table to display data in a structured fashion. index.jsp also requires an HTML form that includes a drop-down list.Make sure index.jsp is opened in the Source Editor. If it is not already open, double-click index.jsp from IFPWAFCAD Web Pages in the Projects window.1. In the Source

14、 Editor, change the text between the tags to IFPWAFCAD Homepage. Also change the text between the tags to Welcome to IFPWAFCAD, the International Former Professional Wrestlers Association for Counseling and Development!. Note: For further content, you can either add HTML elements to the page using t

15、he IDEs palette, as demonstrated below, or just copy and paste the code provided in step 8 directly into your index.jsp page. 2. Open the IDEs Palette by choosing Window Palette (Ctrl-Shift-8) from the main menu. Hover your pointer over the Table icon from the HTML category and note that the default

16、 code for the item displays:Click the icon, and drag and drop a table into the page in the Source Editor, to a point just after the tags. In the Insert Table dialog that displays, specify the following criteria, then click OK:o Rows: 2 o Columns: 1 o Border Size: 0 The HTML table code is generated a

17、nd added to your page. 3. Add the following content to the table heading and the cell of the first table row (new content in bold):4. 5. 6. 7. IFPWAFCAD offers expert counseling in a wide range of fields.8. 9. 10. 11. 12. To view the contact details of an IFPWAFCAD certified former13. professional w

18、restler in your area, select a subject below:14. 15. For the bottom row of the table, drag and drop an HTML form from the Palette into the page, directly between the second pair of tags. In the Action text box, type in response.jsp, then click OK. 16. Type in the following text between the tags of t

19、he form you just created:Select a subject:/strong17. Drag and drop a drop-down list from the Palette to a point just beneath the text you just added. In the Insert Drop-down dialog that displays, type in subject_id for the Name text field, and click OK. The number of options for the drop-down is cur

20、rently not important. Later in the tutorial you will add JSTL tags that dynamically generate options based on the data gathered from the Subject database table. Click OK, and note that the code for the drop-down list is added to the form. 18. Add a submit button to the form by dragging a button from

21、 the Palette to a point just after the drop-down list you just added. Enter submit for both the Label and Name text fields, then click OK. 19. To format your code, right-click in the Source Editor, and choose Format (Alt-Shift-F). Your code is automatically formatted, and should now look similar to

22、the following:20. 21. Welcome to IFPWAFCAD, the International Former22. Professional Wrestlers23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. professional wrestler in your area, select a subject below:35. 36. 37. 38. 39. form action=response.jsp40. 41. select name=subject_id42. /option43. 44. 45. 46

23、. 47. 48. 49. /bodyTo view this page in a browser, right-click in the Source Editor and choose Run File (Shift-F6). When you do this, the JSP page is automatically compiled and deployed to your server. The IDE opens your default browser to display the page from its deployed location:In order to prep

24、are the interface for response.jsp you must first create the file in your application. Note that most of the content that displays in this page is generated dynamically using JSP technology. Therefore, in the following steps you add placeholders which you will later substitute for the JSP code.1. Right-click the IFPWAFCAD project node in the Projects window and choose New JSP. The New JSP File dialog opens. 2. In the JSP File Name fiel

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1