Java has gradually warmed up in recent years. With the introduction of Java SE 5 and Java SE 6, the future of Java is even more brilliant. However, Java-based jsp (the preferred choice for SUN enterprise-level applications) has never been lifted before Java SE 5 was launched, the most important reason is that, although jsp (the first choice for SUN enterprise-level applications) is powerful, its biggest advantage is its biggest disadvantage. Its powerful functionality means complexity, in particular, there are not many visual tools to design the front-end interface, and they are not powerful enough. Therefore, designing jsp (the preferred choice for SUN Enterprise Applications) pages becomes complicated and cumbersome. However, at the same time as Java SE 5 was launched, Sun introduced a new JavaServer Faces (JSF) specification to simplify the development difficulty of jsp (the preferred choice for SUN Enterprise applications. Thus, jsp (the first choice for SUN enterprise-level applications) is on the road to prosperity.
1. What is JSF?
JSF and jsp (preferred for SUN Enterprise Applications) are new partners. Jsp (the first choice for SUN enterprise-level applications) is the technology used for background logic processing, while JSF, on the contrary, enables developers to quickly develop Java-based Web applications, is a presentation layer technology. Currently, JSF1.2 has been officially added to Java EE 5 as a standard.
As a highly componentized technology, developers can drag-and-drop edit operations with the support of some development tools. Users only need to drag the JSF component to the page, you can easily perform Web development. This is its biggest advantage as a componentized technology. The components we can use are not only simple input boxes, but also more complex components, such as table components such as able and Tree components.
As a standard technology, JSF has received support from many tool providers. At the same time, we will also have a lot of good free development tools to use. Not long ago, Sun Java Studio Creator 2 and Oracle (large website database platform) JDeveloper 10g were released as free development tools supporting JSF, it makes JSF quite angry. In addition, we also have some excellent commercial development tools to choose from, such as BEA Workshop (formerly M7 NitroX), Exadel, and MyEclipse plug-in development tools based on Eclipse, it brings great convenience to the vast majority of Eclipse users. IBM's Rational Application Developer and Borland's JBuilder are also good commercial development tools that support JSF visual development.
JSF is essentially different from traditional Web technologies. In traditional Web technologies, users need to capture browser requests, save the client status, and manually control page redirection. The emergence of JSF undoubtedly brings us great convenience. JSF provides an event-driven page navigation model that enables application developers to design the page stream of applications. Similar to Struts, all page stream information is defined in JSF configuration xml (standardization is getting closer) files (faces-config.xml (standardization is getting closer, rather than hard coding in applications. This greatly simplifies the development difficulty of developers and application development.
JSF is also a framework that follows the Model-View-controller (MVC) pattern. The View code and the application logic (Model) are completely separated, so that the applications using the JSF technology can well implement the separation of pages and code. All requests to the JSF page are processed by a front-end controller (FacesServlet). The system automatically processes the user's requests and returns the results to the user. This is not much different from the traditional MVC framework.
In JSF, not only the POJO technology is used, but also the IoC (or dependency injection-DI) technology similar to Spring is used. In the Backing Bean of JSF, we can put the data and operations required by the view into a Backing Bean. At the same time, thanks to the DI technology used by JSF, We can initialize the Managed Bean in the configuration file, and we can also easily integrate with Spring using similar technologies through this technology.
Ii. How to Use JSF in jsp (the preferred choice for SUN Enterprise applications)
Only by combining with jsp (the preferred choice for SUN Enterprise Applications) can JSF make full use of its functions. JSF is integrated through the tag library and jsp (preferred for SUN Enterprise applications. The tag library is equivalent to the server component of ASP. NET. JSF provides a rich set of tag libraries that can generate various client models, such as HTML, WML, xml (more and more standardized), and JavaScript. With these tags, you can easily create a large-scale client model and use these tags to automatically process client requests.
Next let's look at an example of how to bring JSF and jsp together (the preferred choice for SUN Enterprise applications. There are two libraries in JSF. The first is the kernel library, which contains various major labels, such as configuration components, management events, and verification input information. The main function of the second library is to correspond HTML and JSF tags. Each JSF tag corresponds to an HTML component. For example, the UIInput tag corresponds to the text box or password box in HTML.