1 / 53

Eclipse is an open source IDE (Integrated Development Environment) for developing applications in Java, C/C++, HTML, Cob

Building a J2EE Web Application with Eclipse. Eclipse is an open source IDE (Integrated Development Environment) for developing applications in Java, C/C++, HTML, Cobol, Perl, etc.

baakir
Download Presentation

Eclipse is an open source IDE (Integrated Development Environment) for developing applications in Java, C/C++, HTML, Cob

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Building a J2EE Web Application with Eclipse Eclipse is an open source IDE (Integrated Development Environment) for developing applications in Java, C/C++, HTML, Cobol, Perl, etc. The official Eclipse web site (eclipse.org) says, “Eclipse is a kind of universal tool platform -- an open extensible IDE for anything and nothing in particular.”

  2. Building a J2EE Web Application with Eclipse Eclipse: • Provides a consistent feature set on most platforms • Supports more than just Java or any single language • Open source and free, yet fully supported • Truly extensible and configurable • Industrial strength

  3. Overview of a Typical Web Application Recall the typical dynamic web application consists of a web browser, web server, html pages, server pages, and a database Eclipse can be used to create the HTML pages, Server Pages, Database Tables, and test it all using a Web Server and a internal web browser. HTML HTML Scripted page database Web browser Web server request

  4. Eclipse support for creating an Testing Web Applications The following components are used: Apache Jakarta Tomcat servlet engine Derby JavaServer Pages Standard Tag Library (JSTL) WTP (Web Tools Project Plugin) HTML HTML Scripted page database Web browser Web server request

  5. Eclipse support for creating an Testing Web Applications The following components will be used: Apache Jakarta Tomcat servlet engine Derby JavaServer Pages Standard Tag Library (JSTL) WTP JavaServer Pages Standard Tag Library (JSTL) Derby HTML HTML Scripted page database Web browser Web server request Internet Explorer, Firefox, or internal browser Apache Jakarta Tomcat servlet engine

  6. Building J2EE Web Applications with Eclipse When Eclipse is started, it asks you to choose a workspace. The workspace is the location on the filesystem (folder, directory) where your files will be stored. Afterwards you are presented with the Welcome screen if this is your first time using this workspace.

  7. Building J2EE Web Applications with Eclipse On the welcome screen there is an Overview…

  8. Building J2EE Web Applications with Eclipse … Tutorials

  9. Building J2EE Web Applications with Eclipse … Samples

  10. Building J2EE Web Applications with Eclipse And a section on What’s New.

  11. Building J2EE Web Applications with Eclipse Eclipse is divided into Perspectives and Views. A Perspective is the set of screens and functionality for a particular development scenerio (Java, C++). To build a Web Application, first set the perspective to J2EE by selecting Window -> Open Perspective -> Other

  12. Building J2EE Web Applications with Eclipse Select J2EE.

  13. Building a J2EE Web Application with Eclipse Next Create a Dynamic Web Project by selecting New -> Dynamic Web Project

  14. Building a J2EE Web Application with Eclipse Type in a name for the Project. In this case it is FirstWebProject and press Finish. (May be asked to configure a Server)

  15. Building a J2EE Web Application with Eclipse A folder will be created for your Project, appearing under Dynamic Web Projects

  16. Eclipse support for creating an Testing Web Applications The following components will be used: Apache Jakarta Tomcat servlet engine Derby JavaServer Pages Standard Tag Library (JSTL) WTP JavaServer Pages Standard Tag Library (JSTL) Derby HTML Scripted page database Web browser Web server request Internet Explorer, Firefox, or internal browser Apache Jakarta Tomcat servlet engine

  17. DERBY http://db.apache.org/derby • Relational Database implement in Java • Open source version of IBM Cloudscape • Small footprint • Provides an embedded driver

  18. Using the Derby Database for Persistent Data Adding the Apache Derby Nature to the project makes the class files and tools for Derby available to the Project.

  19. Using the Derby Database for Persistent Data Start the Derby Server by right-clicking on the Project and selecting Apache Derby -> Start Derby Network Server. Select Ok when the dialog box appears.

  20. Using the Derby Database for Persistent Data To create a Database, create a script file and execute it. To create the file, right-mouse click on the project and choose New -> File

  21. Using the Derby Database for Persistent Data Type in the name of an sql script file.

  22. Using the Derby Database for Persistent Data Type the SQL for creating the table and inserting data.

  23. Using the Derby Database for Persistent Data To execute the script, right-mouse click on the script file, choose Apache Derby -> Run SQL Script using ‘ij’

  24. Using the Derby Database for Persistent Data The console shows the results of executing the script file. There is a Database Explorer for further manipulating the database.

  25. Eclipse support for creating an Testing Web Applications The following components will be used: Apache Jakarta Tomcat servlet engine Derby JavaServer Pages Standard Tag Library (JSTL) WTP JavaServer Pages Standard Tag Library (JSTL) Derby HTML HTML Scripted page database Web browser Web server request Internet Explorer, Firefox, or internal browser Apache Jakarta Tomcat servlet engine

  26. UML Class Diagram addaccount << link >> main << link >> showaccounts

  27. UML Class Diagram addaccount addaccountToDB <<builds>> confirmanAdd <<submits>> accountInfo

  28. Creating HTML Pages / Server Pages To create a HTML page, right-click on the project and select New -> HTML

  29. Creating HTML Pages / Server Pages Type a filename and press Finish.

  30. Creating HTML Pages / Server Pages Type a filename and press Finish.

  31. Creating HTML Pages / Server Pages Enter HTML for the main menu page.

  32. Creating HTML Pages / Server Pages Enter HTML for the main menu page.

  33. Creating HTML Pages / Server Pages To view the page in a web browser, choose right-mouse click on the editor and choose Run As -> Run on Server. This will start Tomcat (if it is not started) and open the file in the browser. (May have to choose Server and select Projects to add to the Server)

  34. Creating HTML Pages / Server Pages The page displays in Eclipse’s internal Web browser.

  35. Creating HTML Pages / Server Pages To change the web browser Eclipse uses, choose Window -> Preferences -> General -> Web Browser -> Use External browser, and choose the browser you would like used to display the pages (IE, Firefox, etc).

  36. Creating HTML Pages / Server Pages Let’s create the addaccount.html

  37. Creating HTML Pages / Server Pages

  38. Creating HTML Pages / Server Pages

  39. Creating HTML Pages / Server Pages

  40. Creating HTML Pages / Server Pages Here’s what we have so far, viewed with the internal web browser. Selecting the Add Account hyperlink takes us to the addaccount.html page.

  41. Creating HTML Pages / Server Pages Here it is viewed with Internet Explorer.

  42. UML Class Diagram addaccount addaccountToDB <<builds>> confirmanAdd <<submits>> accountInfo

  43. addaccountToDB confirmanAdd <<builds>> <<submits>> accounts

  44. Eclipse support for creating an Testing Web Applications The following components will be used: Apache Jakarta Tomcat servlet engine Derby JavaServer Pages Standard Tag Library (JSTL) WTP JavaServer Pages Standard Tag Library (JSTL) Derby HTML HTML Scripted page database Web browser Web server request Internet Explorer, Firefox, or internal browser Apache Jakarta Tomcat servlet engine

  45. JSTL (JavaServerPages Standard Tag Library) The JSP Standard Tag Library (JSTL) is a collection of custom tag libraries that implement general-purpose functionality common to Web applications, including iteration and conditionalization, data management formatting, manipulation of XML, and database access. • Core Tag Library – looping, expression evaluation, basic input/output • Formatting/Internationalization Tag Library – parsing data, such as dates. • Database Tag Library – tags that can be used to access SQL databases • XML Tag Library – tags can be used to access XML elements

  46. JSTL (JavaServerPages Standard Tag Library) Core Tag Library Example <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> <html> <head> <title>Count to 10 Example (using JSTL)</title> </head> <body> <c:forEach var="i" begin="1" end="10" step="1"> <c:out value="${i}" /> <br /> </c:forEach> </body> </html>

  47. JSTL (JavaServerPages Standard Tag Library) Database Tag Library <%@taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%> <sql:query var="cities"> SELECT CITY_NAME, COUNTRY, AIRPORT FROM APP.CITIES ORDER BY \ CITY_NAME, COUNTRY </sql:query> <c:forEach var="city" items="${cities.rows}"> <c:out value="${city.airport}” /> <c:out value=“${city.city_name}” /> <br/> </c:forEach>

  48. Let’s create the addAccountToDB page. Select New -> JSP

  49. Type in a name

  50. Default page

More Related