|
JSF components also maintain a list of attributes. Those attributes store component-specific information. For example, you may want to store the URL associated with an image used by a component; so you could store that URL—or the image itself—in the component's list of attributes. Component attributes are stored by name in a hash map. Java Web application development with JSF can be surprisingly easy once you master its intricacies. That said, JSF's default mechanism for managing workflow is not very powerful in terms of integration with existing technologies. Enterprise systems require more advanced workflow management than JSF provides. JSF falls short when it comes to embedding rules to determine the destination and routing of non-JSF pages, as well as handling exceptions and global transitions. Once you decide to use JSF as your Web framework, the next question you might have is which JSF implementation to choose. Indeed, many JSF component sets and libraries are available, both as open source and commercial offerings. Among them, the MyFaces implementation meets most needs well in terms of building an enterprise-grade real-world application without requiring you to make your own components. MyFaces not only provides a rich set of pre-built components, it also addresses many shortcomings and issues found in JSF 1.1. Recently, Oracle ADF (Application Development Framework) components have joined the MyFaces family. Let's see how MyFaces solves a classic Web application use-case. However, its out-of-the-box state is not without its faults. In this article, I illustrate how a particular set of frameworks—specifically, Shale from the Apache Software Foundation and Seam from JBoss—has already stepped up to fill in the gaps of this up-and-coming Java technology. With that said, you should realize that JSF represents an elaborate technology in and of itself, so if you are unfamiliar with its core concepts, you are advised to check out the links in Resources to get up to speed on the terminology used in our exploration, as we will jump right into the deep end of JSF. When you need to Ajax-enable a JSF component, AjaxComponent is a solid strategy for doing it. AjaxComponent also works seamlessly with the JSF AjaxCommand strategy described in my previous JavaWorld article. We'll start by taking a look at how you would set up the server side of the request, based on the AjaxCommand strategy. After that we'll look at the front-end design, and I'll conclude by comparing the original Command pattern with the AjaxCommand variation. Both of the two syntaxes mandate that the f:selectItems tag or the f:selectItem tag (which are actually responsible for individual radio items) must be nested inside the h:selectOneRadio tag. All the radio buttons behave as if they were residing under a radio button group. We cannot put this radio button inside a JSF dataTable tag and span the radio button group behavior across rows or across columns because h:selectOneRadio cannot contain the h:column element, which represents a column inside an h:dataTable. When each column is rendered, the name generated by the JSF containers differs for each cell. As a result, individual radio buttons receive different names and create separate radio groups (with only one radio) in each group. Shortly after the first JavaServer Faces (JSF) early access (EA) release was introduced in September 2002, I wrote two JavaWorld articles detailing JSF (see Resources). Since then, JSF has matured considerably over four EA releases, and today, with a beta release in the wings, is poised to take the stage as the preeminent Java Web application framework. Furthermore, as the standard framework for developing Web applications, JSF will enjoy strong tool support from vendors like Sun Microsystems and its Project Rave development tool—a direct competitor to Microsoft's Visual Studio. JavaServer Faces (JSF) technology is a new user interface framework for J2EE applications. It is particularly suited, by design, for use with applications based on the MVC (Model-View-Controller) architecture. Numerous articles have introduced JSF. However, most take a highly theoretical approach that doesn't meet the challenges of real-world enterprise development. Many issues remain unsolved. For example, how does JSF fit into the overall MVC architecture? How does JSF integrate with other Java frameworks? Should business logic exist in the JSF backing beans? How do you handle security in JSF? And most importantly, how do you build a real-world Web application using JSF? Developers reap the benefits of standardizing tools and components for JavaServer Faces. With standards, developers can pick and choose tools and components from a variety of vendors that best fit their needs. Many of the JavaServer Faces-enabled tools come from vendors that developers are already familiar with. When compared to components built from scratch, JavaServer Faces components are more powerful and of better quality. Spring Web Flow 2 supports JavaServer Faces technology through the new Spring Faces module. Spring Faces lets you use JSF as a view technology in Web applications, with the Spring MVC Web framework underneath. Not only does Spring Web Flow 2 address a few thorny JSF programming issues, but it also it gives you advanced features available only in the JSF 2.0 specification. JavaWorld contributor Xinyu Liu presents an overview of Spring Web Flow 2 and details its benefits for JSF developers. JavaServer Faces was developed with IDEs and rapid development of Web applications in mind. But is JSF living up to its promise? Can an IDE built around JSF potentially improve our productivity? Can such a tool help us create and deploy functioning Web applications faster than currently available options? The best way to answer this question is to test-drive one of the current IDEs that support drag-and-drop JSF development and attempt to develop a real Web application, a task I describe in this article. JavaServer Faces (JSF) is an application framework for creating Web-based user interfaces. If you are familiar with Struts (a popular open source JSP-based Web application framework) and Swing (the standard Java user interface framework for desktop applications), think of JavaServer Faces as a combination of those two frameworks. Like Struts, JSF provides Web application lifecycle management through a controller servlet; and like Swing, JSF provides a rich component model complete with event handling and component rendering. Web browsers provide an easy way for sending files to web applications, but the current versions of the Java web standards (servlets, JSP, and JSF) do not offer any help. Fortunately, there are third-party frameworks, such as Apache Commons File Upload, Apache MyFaces, and Oracle ADF Faces, that implement this feature, exposing simple APIs and custom tags. The first half of this article explains how file uploading works, walking you through the source code of MyFaces and Commons File Upload (the former uses the latter internally). It is helpful to know what happens inside of these open source frameworks in order to use them efficiently, and to be able to modify them if you have to. In the second half of the article, you'll find a sample application that lets users upload files using their web browsers. Editor's note: O'Reilly's JavaServer Faces offers developers a guide to learning how to use the JSF framework to build web applications. In this excerpt from the book, author Hans Bergsten looks at the JSF event model, using examples to help explain what's going on "under the hood." Next week, in part two of this excerpt, Hans implements event handling for parts of the sample application discussed here. JavaServer Faces (JSF) has been dubbed the next big thing in Java web programming. With JSF, you use web components on your web pages and capture events caused by user actions. In the near future, Java tools will support this technology. Developing web applications will be similar to the way we write Swing applications today: dragging and dropping controls and writing event listeners. This article is an introduction to JSF. It highlights the most important aspect of JSF: JSF applications are event-driven. Also, it offers a sample JSF application that illustrates the event-driven-ness of JSF. To understand this article, you need to be familiar with servlets, JSP, JavaBeans, and custom tag libraries. 17. Using JSF Handling HTML forms is one of the most common tasks when you develop web applications. A good framework can save a lot of development time because there are many routine operations that can be done automatically, or reduced to just a few declarations in an XML file. It is also possible to simplify web development using well-designed JSP tag libraries. The JavaServer Faces framework provides JSP tags for rendering HTML forms, manages the state of the forms, validates user-input reporting errors, lets you bind user interface components to JavaBean properties, and does many other things that increase your productivity. JSF also has a rich API that you can use to build custom user interface (UI) components, custom validation classes (validators), and server-side event listeners.Page navigation is an important aspect of web programming. The more complex an application is, the harder it is to manage how users navigate from one page to another. JavaServer Faces (JSF) solves this problem by allowing page navigation to be configured in the Application Configuration file. This is one of the features that will make JSF the first choice of web application development in Java in the future. You can download the sample application here. The examples were tested using JSF Early Access 4. Refer to the article "Introducing JavaServer Faces" on ONJava.com on how to deploy your JSF application. The article can also be the first reference if you are not familiar with JSF. This article is meant to acquaint the reader with JavaServer Faces, commonly known as JSF. JSF technology simplifies building the user interface for web applications. It does this by providing a higher-level framework for working with your web app, representing the page as event-aware components rather than raw markup. Editor's note: The JSF model has the same look and feel as the event model used for standalone applications, but because user actions in JSF take place in a client separated from the server, delays occur in the delivery of some types of events until a new connection is established. In last week's part one of this two-part excerpt from JavaServer Faces, author Hans Bergsten provided examples to show how JSF deals with this difference, by using a strict request processing lifecycle. Here in part two, Hans implements event handling for parts of the sample application discussed in part one. JavaServer Faces attempts to solve some of these issues, and a few others not mentioned here. JSF prescribes an architecture for projecting the UI to a client and allowing different rendering kits to render the UI for the specific client. The state of the components and their values can be maintained on the server and the UI components can generate events that are handled by the server. JSF also defines functionality for data conversion, validation, and localization. JSF promises a bright future for Java web developers -- a future that should allow for much richer support than what's currently available. If you haven't started looking at JSF yet, it's time to do so. There's even a Struts/JSF library that's been added to Struts by Craig McClanahan. The real problems JSF has are serious. They're not show-stoppers; they can be fixed, and they're being fixed. There are better component sets out there already, some of which provide the components and backing models that JSF was designed to enable. Facelets replaces the JSP presentation mechanism with something much faster and much cleaner (in your Humble Author's opinion). The formation of the JSF 2.0 expert group is designed to bring the benefits of Java EE's simpler model to JSF. The documentation is constantly being revised, and with new books on JSF on the shelf (not even counting the books focusing on Jboss' excellent Seam project, which uses JSF), the documentation will soon reach a tipping point where JSF becomes more accessible. This review gives a summary on current commercial JSF Frameworks that use Ajax to update the website. The frameworks Icefaces, Netadvantage and Quipukit will be compared by analyzing specific components to each other. Moreover, we will give you detailed information about positive and negative impressions and experiences we gained about them during the installation and using them in practice. To use the G4jsf CDK, you need the Google Web Toolkit SDK. Google does not allow the distribution of the Google Web Toolkit SDK, so you need to get it from Google at http://code.google.com/webtoolkit/download.html. Creating a component in JavaServer Faces is hard. The JavaServer Faces 2.0 EG recognizes the importance of making component authoring easier and has made it one of its top priorities. However, JSF 2.0 is too far off to wait for. Let's look at why it's hard to create a component, then I'll show one way to help simplify this process. After several years as the leading Java web application framework, the reign of Apache Struts appears to be drawing to an end. Indeed, the action-based model on which Struts is based is no longer regarded by many as ideal for Java web application development. While Struts and many other Model View Controller (MVC) frameworks from the early 2000s are largely operation-centric and stateless, the frameworks emerging most strongly are component-based and event-driven. The leading contenders in this space are the new "standard", JavaServer Faces (JSF), and Strut's cousin from the Apache Jakarta project, Tapestry. The chapters of the JavaServer Faces in Action book are being made available to allow the community to participate in the review and editing of the chapters of the book. Your comments and suggestions may make it into the final product, if appropriate. You can help us write this book, by just sending a note to [email protected] with your corrections and suggestions. JavaServer Faces: The Complete Reference offers coverage of JavaServer Faces (JSF) including JSF custom component development. Written by experts directly involved in JSF development, this book covers everything JSF, from using Hibernate to integrate JSF with production-quality databases to techniques for debugging and developing automated software tests for JSF applications. The tutorial also serves as a thorough introduction to AJAX technology and techniques, and includes numerous custom JSF component examples including AJAX-enabled components. This article covers anti-patterns and pitfalls of day to day JSF development. Most of these issues have kept the author up at night; some of these are the same old challenges with a new face, pun intended. These challenges include performance, tight coupling, thread safety, security, interoperability and just plain ugliness. The HTML code is written as template text. The Java code is encapsulated in constructs known as scriptlets. The mix of languages is at best cryptic and out of reach for most non-Java developers. This makes it difficult to separate tasks and roles during development. 31. JSF Flex The goal of JavaServer Faces Flex is to provide users capability in creating Flex components as normal JavaServer Faces components. So users would create the components as normal JSF components and the project will create the necessary SWC, SWF, and other components, and link the values of the components back to the managed beans using JSON+JavaScript and ActionScript. By doing so, developers who are unfamiliar with Adobe Flex can be completely abstracted from its technology and focus in linking the application's data to legacy information. This article will provide a quick overview of the project, a brief introduction of the technical info regarding its design, and how to build the SNAPSHOT artifacts by downloading the source code to the local machine. Please note that the project is in its infancy state, so it is probable that it will undergo transformation in the future.One of the key strengths of JavaServer Faces (JSF) is that not only does it provide substantial technology for easy, out of the box component based J2EE Web applications assembly, but it also is a very flexible API which allows for a wide breadth of customizations in numerous and innovative ways. This article introduces and explores the component developer's experience of building custom JSF user interface (UI) components. 33. JSF at Big Lots! One of the great things about working on software infrastructure is the ubiquity and wide influnce one has due to the nature of the users of infrastructure software. I drive past a Big Lots! store in Apoka, FL regurlarly, so it was with great interest that I attended the JBoss World 2008 case study titled, "Big Lots Store Inventory Management". I wasn't exactly sure what I would learn during this presentation, but it turns out I was to be delighted. Big Lots! has had enormous success with Sun's JSF implementation, Mojarra, and other Java EE technologies in delivering inventory management and other store essential software on time and within budget.This article looks at the unified expression language (EL), which has been added to the JavaServer Pages Standard Tag Library (JSTL) specification in order to overcome problems when integrating the JavaServer Pages (JSP) EL with the JavaServer Faces (JSF) EL. Two great open source projects are currently hosted on the Flying Saucer All-Java XHTML Renderer and the Facelets Java Server Faces Framework. At first glance, these two project might seem to target different audiences--the JSF Facelets Project seems to be aimed at server-based applications, while the Flying Saucer XHTML Renderer is mainly for use in the desktop arena. Despite this, however, these two projects have a high level of synergy. In this article we will be exploring how it is possible to combine these two technologies from different backgrounds to render more than just simple HTML web pages. This article illustrates how to build custom components for use in web applications based on JavaServer Faces (JSF). While JSF comes with a standard set of components, one of the most-publicized features is the easy addition of new components. In this article, you will see just how easy it is to create new components that are fully functional and integrated into your web applications. Specifically, this article will show how to develop a component that allows users to enter valid credit card numbers. JavaServer Faces (JSF) is a server-side user interface component framework for Java-based web applications. As a standard web development technology, JSF 1.2 is encapsulated as part of the latest Java EE 5 specification. JSF promotes a component-based, event-driven UI development methodology, independent from any mark-up language, protocol, or client device. Inspired by MVC frameworks like Struts, the JSF API has built-in support for internationalization, localization, data type conversion, and validation. Developing scriptlet-free web pages becomes possible in collaboration with JSTL tags. Recently, AJAX-JSF UI components have gained a lot of attention in Java communities, because they deliver a rich user experience similar to desktop applications and can be used off-the-shelf without requiring deep knowledge of remote scripting in JavaScript. As a view-tier MVC solution, JSF with dependency injection and pluggable APIs can be easily integrated with business-tier technologies like Spring, JBoss Seam, and EJB 3.0. Evidently, the JSF community endeavors to interface JSF with a variety of exciting new technologies. To benefit fully from the great features that JSF and JSP 2.0+ offer, developers must give up their stale JSP/servlet programming style and migrate to the new world of JSF. The following sections are presented to facilitate this process. JavaServer Faces technology is great for encapsulating a component's artifacts, which hides complexity from the end user. In the quest to create reusable components, the developer has to make trade-offs between complexity and reusability. When designing components, developers find that most development projects require the repetition of common tasks. One function that is commonly required is accessing static and dynamic resources. Static resources are usually JavaScript technology files, cascading style sheet (CSS) files, image files, presentation fragments, and so on. Dynamic resources are usually associated with functions that change based on the input, such as Asynchronous JavaScript and XML ((Ajax)) calls, form submissions, and link actions. JavaServer Faces (JSF) is a server-side technology for developing web applications with rich user interfaces. With JSF, you can resolve such technical challenges as creating custom user interface components. This is because JSF technology is a user interface framework for building Java-based web applications that run on the server side, and render the user interface back to the client. That's right! The user interface code runs on the server, responding to events generated on the client. Ed Burns: So, presentation goals. I would like to show that the combination of AJAX and JSF, whatever vendor you are choosing, is a great way to go for building enterprise applications. I want to show one concrete way of using those two things together and some new content that I just added because I have given this presentation before is one concrete way of testing AJAX plus JSF applications, but as it turns out, this testing methodology that I am going to show does not apply just to JSF, it is any old AJAX application at all. Finally, I would like you to leave the presentation having some understanding of how to evaluate an AJAX plus JSF solution for yourself. We find ourselves in a similar position to what we were in before JSF was started in 2001, and that is at that time we had a lot of different web frameworks out there. They were competing for being the web framework of the day and the idea with JSF was to get the best ideas of all those frameworks and put them into the JCP standard. Now, as it turns out, we are six years down the line here and there are still a lot of other web frameworks out there, but JSF has gained and grown market traction both in terms of number of sites using it, in terms of vendors providing tools and components for it, and so with AJAX there are a lot of different vendors providing JSF and AJAX solutions. The panel discussion this afternoon at 2:30, we are going to have Steve Maryka from ICEsoft, and he has a very nice JSF and AJAX solution. I will be representing Sun, we have the one that I am going to talk about today, and there are a number of others, and I will list them on a slide, but anyhow I want to give you some knowledge so that you can look at these different solutions and say which one is right for me? What are the attributes that it has? Do they match to my requirements for my enterprise? Both View and Action essentially will return String outcomes. These String values are used by Apache Shale Dialog Manager's Transition construct. Transitions map values returned by Views and Actions to the next target View or Action. Transitions can be defined either at the dialog level or the local state level (View or Action). The Shale engine uses dialog-level Transitions when it cannot match String outcomes from View or Action to local Transitions. Listing 5 shows how the values of next and exit returned by userid.jsp are mapped by User ID's local and dialog's global transition. 'Next' is mapped locally at the View level, while 'Exit' is mapped at the dialog level: JSF is different than most Java Web-application frameworks, such as Struts, which treat each page request as a single event. JSF pages are comprised of multiple components that can each trigger individual events. Each component represents one or more Web page elements capable of generating dynamic output or providing user input. In JSF parlance, an individual component such as a text box or a button is said to be a simple component. A compound component is one that is comprised of multiple elements such as a table. The JSF component model is similar to the component model that traditional non-Web MVC frameworks such as Swing use. One benefit of this component model is that it should foster the creation of development tools that allow user interface designers to drag and drop components into a layout. Then, after creating a visual layout of the components, the developer(s) can write event-handling code that will allow the view components to interact with the application model. This could allow for faster GUI creation for prototyping and while doing rapid application development (RAD). Much has already been written about JSF, and based on the high number of posts to Sun's JSF Developer Forum, many are already kicking its tires and use JSF for both prototypes and real applications. But as with any new specification, JSF 1.0 has some rough spots. In this article, I focus on one specific area of the JSF specification that I feel is riddled with problems: namely, the use of JavaServer Pages (JSP) for creating JSF views. I also discuss alternatives to JSP that you can develop today and that I hope will make it into a future version of the specification. In JavaServer Faces, developers learn how to use the new JavaServer Faces framework to build real-world web applications. The book contains everything you'll need: how to construct the HTML on the front end; how to create the user interface components that connect the front end to your business objects; how to write a back-end that's JSF-friendly; and how to create the deployment descriptors that tie everything together. This book is a complete guide to the crucial new JSF technology. Full Description This tutorial series is about getting started with JavaServer Faces (JSF) technology, a server-side user-interface component framework for Java-based Web applications. The series is for developers who are new to JSF and want to come up to speed quickly ? not just with JSF, but with using JSF components to reduce effort. The series covers just the essentials, with lots of examples. The first article in this three-part series introduced Seam, an application framework that significantly enhances the capabilities of JSF and substantiates the component-based architecture on which it is based. In that article, I explained what differentiates Seam from other Web frameworks typically paired with JSF, showed you how easy it is to add Seam to an existing JSF application, and concluded with an overview of Seam's enhancements to the JSF application life cycle, touching on stateful conversations, factory components, and no-fuss configuration using annotations. This tutorial provides an overview of JavaServer Faces (JSF) and walks you through the basics for developing Web applications using the technology. With Java developer and consultant Jackwind Li Guojie as your guide, examine the JSF life cycle, input validation, event handling, page navigation, and internationalization ? all of which are illustrated through a sample application. Fear, uncertainty, and doubt (FUD) has been circulating about J2EE's JavaServer Faces (JSF) technology for a while now and I've decided the time has come to put a stop to it; or at least offer a balancing perspective. The first myth about JSF is that you need a WYSIWYG drag-and-drop tool to do JSF development. The second is that JSF doesn't support MVC Model 2 frameworks like Struts. And the final, most all-encompassing myth about JSF development is that it's just plain difficult. Design patterns help users to abstract details at a higher level and better understand architecture. If you are familiar with Gang of Four design patterns and the JavaServer Faces (JSF)framework in general, this article will help you gain insight about the design patterns used in JSF framework, and how they work in-depth. In this second article in the JSF for nonbelievers series, I'll walk you through the six phases of the JSF request processing lifecycle. I'll explain what happens in each phase and how the phases interconnect, then use an example application to demonstrate the lifecycle in action. Along the way, I'll also show how to work with some of the built-in JSF components briefly touched on in Part 1. I'll also show you how to incorporate Struts Tiles into your JSF development, and how to combine JSF and JavaScript for immediate event handling. Throughout this series I've tried to help you overcome the FUD that has caused many Java developers to shy away from using JSF technology. I've discussed the basic misconceptions about the technology and served as a tour guide to both its underlying framework and its most worthy development features. With all the background work out of the way, I think you're ready to take the plunge and develop your own custom JSF components. As with all things JSF, I promise it will be easier than you think and far too rewarding, in terms of time and headache saved, to ignore. This comprehensive hands-on tutorial by Java? enterprise developer Faheem Khan examines how XForms authoring requirements fit into the JSF architecture. The author begins with a solid overview of JSF technology, then identifies the tasks you must perform if you plan to use JSF technology for XForms authoring, and demonstrates the development of a JSF tag library capable of authoring XForms markup. Throughout the tutorial, he guides your learning with a sample application to help you see the concepts put to work in a real-world application. Note: This tutorial is comprehensive and will take a significant time investment to complete. This final installment wraps up the five-part tutorial series by introducing you to the Spring Framework. Learn to integrate your Java?Server Faces (JSF) applications with Spring, a popular framework that makes it easier for Apache Geronimo developers to build Java Platform, Enterprise Edition (Java EE) applications. You'll use Spring to continue developing the front end for the example Developer Forum Signup application. While working on a Java?Server Faces (JSF) project recently, I had the pleasure of using Facelets for the first time. What I most liked about Facelets was that it let me create reusable composition components. Being able to take a page (like a JSP) and turn it into a component has been a real boon to my JSF development ever since. My conclusion? If you're not using Facelets, you're not getting the most you can out of JSF. This month, Rizon Software's CTO Paul Tabor joins me on my quest to dispel the FUD about JSF. In this article, we'll work through the concepts of JSF's conversion and validation framework, which is much simpler to use and far more flexible than you may think. In my search for an extension to complement JSF's component-driven architecture, I recorded short stints with both Shale and Struts 2. I ruled out Struts 2 because it treats JSF as merely a stepchild to a much broader design. Shale seems to come closer, being fundamentally based on JSF, but I have some reservations about it. In contrast, JBoss Seam is a comprehensive application framework that builds on the foundation of JSF without compromising any of its core goals. The first question I needed to know was why Apache Geronimo was even concerned with Apache MyFaces in the first place. Tim explained that it was part of the migration from Java? 2 Platform, Enterprise Edition (J2EE) 1.4 to Java Platform, Enterprise Edition (Java EE) 5. "Geronimo is already a J2EE 1.4-compliant application server, but as part of the 1.5 specification, JSF needs to be supported, and the way we're doing that is with Apache MyFaces." Having updated faces-config.xml with the proper references to your JSF page and backing bean, follow the steps described under Creating a JSF Portlet and you are done. No doubt the name at least is familiar: JavaServer Faces has been talked about a lot, and much anticipated, with good reason. For years there have been an ever-expanding choice of ways to take your web application's output and get it on a page (or on some other kind of display). The Servlet API did a lot to enable the first Java web applications - having created web applications for Java before Servlets, I can attest to how much it helped! The first web applications with Servlets cranked out HTML directly - pretty much everyone now agrees this was a bad plan, and hard to maintain to boot. Next came toolkits such as Apache's Element Construction Set that generated the HTML for you. A step in the right direction, but not far enough for most. Then came JSP: A hybrid, in some ways, between an HTML page and a Servlet. JSP was a significant step forward from Servlet-generated HTML - If you use it right (and that's a critical if), you can enforce a pretty clean separation of view and application logic. Better still, JSP's, particularly once tag libraries came along, were simple enough that non-programmers could help with the page layout process, particularly for HTML formatting. JavaServer Faces is a very solid, standardized technology that greatly advances GUI development of the J2EE applications. Its popularity among developers makes it a clear winner in the frameworks space going into 2006. The two checks that are performed in this message are to verify that a value was actually entered and to check whether the user already guessed that letter. If either of these conditions turns out to be true, a new FacesMessage with the appropriate internationalized error message is created, and a ValidationException is thrown. JSF then will recognize the fact that validation did not pass, and will display the generated message on the UI wherever the We've only examined a few of the many powerful UI frameworks available in open source today, and have just scratched the surface of how these frameworks might be tied in to JSF (or vice versa). Hopefully though, this exploration of the possibilities is enough that you can see that JSF is not necessarily an "either/or" choice with existing UI tools and frameworks, but that to a large degree synergistic co-existence is possible. This has the potential to allow developers to take advantage of what's good in JSF, and to come together on a single component standard over time, while at the same time not disrupting current development, nor losing the unique advantages of other UI frameworks. In the previous article, I discussed the similarities and differences between the ASP.NET and JavaServer Faces frameworks. Two sample two applications were shown. One of the applications was developed using JSF and the other used ASP.NET. Both applications served the same functional purpose: to allow employees to reserve conference rooms. Both web applications accessed the same MySql database. I used two popular IDEs (Integrated Development Environments) to assemble the applications: Microsoft's Visual Web Developer 2005 Express Edition (Get a copy) and Sun Microsystem's Java Studio Creator (Get a copy). During the development process, I tried to illustrate some of the basic concepts behind each framework. The faces-config file is also where you list all JavaBeans associated with your JSP page file. In fact, this is where you can configure any Java objects your application needs to reference. These Java objects are referred to as 'managed beans'. All JSF backing beans will be listed as managed beans in this configuration file, but any other objects you need will be found here too. A managed bean contains the fully qualified class name, the scope of the bean (whether to store it at the Request, Session, or Application level of the application), and the name to use when referencing the bean. In the XML below, the backing bean for the starting web page is listed as well as an entry for an EJB (Enterprise JavaBean) called ReservationsSessionBean that we use to share data in the application: This chapter gives an overview of JavaServer Faces technology. After going over some of the primary benefits of using JavaServer Faces technology and explaining what a JavaServer Faces application is, it describes a simple application and specifies which part of the application the developers of each role work on. It then describes the UI component model, the navigation model, and the backing bean features supported by JavaServer Faces technology. Finally, this chapter uses a page from a simple application to summarize the life cycle of a JavaServer Faces page. |
| w__w___w___.___j_a___v__a__2___s___.___c_o__m | Contact Us |
| Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
| All other trademarks are property of their respective owners. |