The NetBeans E-commerce Tutorial - ConclusionTutorial Contents
Congratulations! You have now finished developing the You can view a live demo of the The completed Delivering your WorkWhen delivering your work, you should prepare both a WAR (web archive) file, which is a compiled, ready-to-deploy version of your project, and a source distribution, which contains all the source files you created during the development phase.
As was indicated in the tutorial Scenario, a
"technically-oriented staff member is able to deploy the application to the
production server once it is ready." Aside from necessary performance tuning
(GlassFish tuning is discussed in Unit 12 Testing
and Profiling) the person responsible for this would need to ensure that the database
driver is accessible to the server (i.e., place the driver JAR file in the server's
library folder). He or she would also need to know the JNDI name of the data source used
by the application to interact with the database. This is found in the persistence unit
( Note: Recall that the In terms of security, it would be necessary to set up a user and group on the production server, so that the server can authenticate persons wanting to log into the administration console. Also, SSL support for the production server would need to be enabled, and you would need to acquire a certificate signed by a trusted third-party Certificate Authority (CA), such as VeriSign or Thawte. Once the database is created and tables are populated with necessary data, the connection pool and JDBC resource are set up on the production server, and security measures have been taken, the application WAR file can be deployed to and launched on the production server. Using GlassFish, it is possible to deploy your applications via the Administration Console. (Select Applications in the left-hand Tree, then click the Deploy button to deploy a new application.) The GlassFish plugin support in NetBeans also enables you to connect to a remote instance of GlassFish. You can therefore work with a GlassFish production server from the IDE for monitoring, profiling, and debugging tasks. If you are interested in using GlassFish as a production server, refer to the See Also section below for a list of web hosting solutions. Portability is among the key benefits of Java EE. As your application adheres to
the technology specifications, it can theoretically be deployed to any server that supports
the same specifications. Recall that the Introduction lists
the specifications that you have used in this tutorial. All of these specifications are
part of the Java EE 6 platform specification (JSR 316). Therefore, any server that is Java EE 6-compliant would be
a candidate for running the Did you know?The NetBeans IDE began as a student project (originally called Xelfi) at Charles University in Prague, Czech Republic in 1996. The goal was to write a Delphi-like Java IDE. Xelfi was the first Java IDE written in Java, with its first pre-releases in 1997. NetBeans was later purchased by Sun Microsystems in 1999, and shortly thereafter became Sun's first sponsored open source project. In June 2000, the initial netbeans.org website was launched. You can view an archived version of the site at: http://web.archive.org/web/20000815061212/https://netbeans.org/index.html For more information, see A Brief History of NetBeans. Using the JavaServer Faces FrameworkHaving developed a Java web application from scratch puts you in a great position to
begin appreciating how a framework can benefit your work. This section briefly introduces
the JavaServer Faces (JSF) framework, then examines the advantages of applying the
framework to the What is the JavaServer Faces Framework?The JavaServer Faces framework (JSR 314) is an integral part of the Java EE platform and aims to facilitate web development by providing the following:
The JSF framework manages the request-response cycle by automating events that typically need to occur for each client request. These events are qualified into six distinct phases that are together known as the JSF request processing lifecycle. The book, JavaServer Faces 2.0: The Complete Reference by Ed Burns and Chris Schalk, describes the lifecycle phases as follows: [T]he request processing lifecycle performs all of the necessary back-end processing for which one would otherwise have to write his or her own code. The lifecycle directs the processing of incoming request parameters, and it manages a server-side set of UI components and synchronizes them to what the user sees in a client browser. It also satisfies follow-up requests for images, style sheets, scripts, and other kinds of resources required to complete the rendering of the UI.[1] The six lifecycle phases, according to JavaServer Faces 2.0, are defined as follows:
![]() One important concept of the JSF framework is the server-side UI component tree, or Faces View. This component tree is built and maintained in server memory for each client request, and is primarily associated with the first and last phases of the request processing lifecycle depicted above. Consequently, the application is able to maintain state between requests in a way that doesn't involve any manual coding on the part of the developer. In other words, the request processing lifecycle handles synchronization between the server-side View and that which is presented to the client. This enables you, the Java web developer, to focus on code that is specific to your business problem. How Can JSF Benefit Your Project?To understand JSF's benefits, let's take a second look at the Strong Templating SupportRather than creating your application page views in JSP pages, you'd be using Facelets
technology instead.[3]
Facelets is a first-rate templating technology that enables you to maximize markup reuse
and reduce redundancy in your page views. Also, because Facelets pages use the In the With Facelets templating, you have more control over which portions of markup get displayed
for individual page views. For example, you could create a template layout that is common
to all page views, and insert view-specific content into the template to render your views.
In this manner, you could specify a title for each page view. (Notice that in the
No Need to Handle Incoming Request ParametersUpon reexamining the No Need to Programmatically Configure NavigationIn order to set up navigation, we followed a certain pattern when implementing the
None of this is necessary when using JSF - navigation is handled by the framework. Your job would be to either associate page views with URL patterns and any logical outcomes using a Faces configuration file, or take advantage of JSF 2.0's implicit navigation feature, which automatically forwards a request to a view that has the same name as the requested URL pattern. Built-in Validation SupportJavaServer Faces provides built-in server-side validation support. In the It would be worthwhile to take advantage of this validation for the
The Continuing with the example, if we wanted to check whether input for the field hasn't
exceeded 45 characters, we could apply the <h:outputLabel value="name: " for="name"> <h:inputText id="name" size="30" maxlength="45" required="true" value="#{checkoutBean.name}"> <f:validateLength maximum="45" /> </h:inputText> </h:outputLabel> <h:message for="name" /> Well-Defined Division of LaborAs stated in the Java EE 6 Tutorial, "One of the greatest advantages of JavaServer Faces technology is that it offers a clean separation between behavior and presentation for web applications." If you are working on a large project that involves a team of developers, the framework functions as a blueprint which allows team members to focus on different areas of development simultaneously. For example, front-end developers can implement page views using tags from JSF's HTML Library, while programmers responsible for implementing component logic and behavior can "plug their work into" existing HTML library tags. Ability to Render the View with Other Markup LanguagesSuppose that the Affable Bean staff commission you at a later point to prepare a mobile version of their site, so users can access it using a hand-held device. JSF APIs are a flexible rendering technology that enable you to attach multiple renderers to the component tree (i.e., View) of a JSF-enabled application. In other words, it is possible to create custom components that, for example, render HTML when requested by a browser, or WML when requested by a PDA. See AlsoNetBeans TutorialsCommunity-Contributed Extensions of E-commerce Tutorial
JavaServer Faces
Contexts and Dependency Injection JavaServer Faces
GlassFish Web HostingAbout the NetBeans E-commerce Tutorial![]() The NetBeans E-commerce Tutorial and sample application were conceived of and written by Troy Giunipero. The application began as a project arising out of Sun's SEED program, and was developed from January 2009 to November 2010. The tutorial was prepared as part of ongoing efforts to provide documentation for the IDE's Java EE & Java Web Learning Trail. AcknowledgmentsMany people have helped with this project. I am especially grateful to following individuals for their help, support and contributions:
DisclaimerThis tutorial and sample application are solely available for educative purposes. Although the sample application demonstrates a real-world scenario, there are several aspects that are decidedly not "real-world". For example, e-commerce sites do not typically store customer credit card details, but allow payment to be managed by a reputable third-party service, such as PayPal or WorldPay. Furthermore, although not discussed in the tutorial, customer trust is a hard-earned commodity. An e-commerce site's privacy policy, as well as the terms and conditions surrounding placed orders should be made easily available to customers and site visitors. The sample application and project snapshots are provided "AS IS," without a warranty of any kind. If you aim to use or modify this software for your own purposes, please comply with the license presented at http://developers.sun.com/berkeley_license.html. References
|
Documentation |