Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

Sponsored Links

Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs

Spring Web Flow 2: A boon to JSF developers

JSF 2.0 features elevate SWF 2 to more than a page-flow engine

  • Print
  • Feedback

Page 4 of 4

Portlet support

The JSF API is designed to support access to both the Servlet and Portlet (JSR 168) APIs by exposing an abstract class called ExternalContext. The JSF Portlet Bridge (JSR 301) is an integration library that allows JSF Web applications to run as portlets within a portlet container. Spring Web Flow includes full support for JSR 168 portlets -- in particular, JSF-enabled portlets. As long as you don't touch the underlying Servlet and Portlet APIs in your Java classes, the POJO programming style in Spring and Spring Web Flow effectively makes your JSF applications neutral to the servlet and portlet environments. The adjustments necessary to translate a JSF Web application into a portlet are solely configuration based.

Security integration

Spring Security (formerly Acegi Security) is definitely a good reason to use Spring for Web applications. (My article "From Java EE Security to Acegi" explores Spring Security's comprehensive and powerful features in detail.)

Portlet security

A portal application usually provides gateway protection to the hosted portlets. User identities (principals) are passed from the portal application to the portlets. The standard approach to portlet security is to map roles defined in a portal application to the roles of the hosted portlets. An advanced Spring approach is to have Spring Security take care of the portlet role mapping, which can be decoupled from the portal roles. The Spring approach gives you the full power of Spring Security. See "Securing Portlets with Spring Security" in Resources for more information.

You can employ Spring Security in different application layers with different granularities, including:

  • At form field (UI component) level, through custom JSP (JSF) tags
  • At URL pattern level, through XML configured aspect-oriented programming (AOP) interceptors
  • At source code level, either programmatically or through JSR-250 common annotations

From the standpoint of Spring Web Flow, individual flow, state, and transition can be declared as protected by roles. If you think of security configured in different application layers as laid out vertically, then Web flow security is conceptually horizontal.

In conclusion

Spring Web Flow 2, with its impressive JSF support, is a workflow engine designed specifically for Web page navigation. Its flow definition language enables you to separate the concerns of page navigation from Web user interfaces and view-independent business logic -- which also makes JSF backing beans completely unnecessary. New enhancements related to Ajax, validation, persistence, and security facilitate the development of rich Web applications. As a new Web development approach, the technology helps JSF developers with an enhanced degree of flexibility and productivity. The Spring Web Flow 2 release available for download (see Resources below) is packed with JSF and portlet sample applications that can help you get a jumpstart on the technology.

About the author

Dr. Xinyu Liu is a Sun Microsystems certified enterprise architect working in a healthcare corporation and an IT consulting firm.

Read more about Enterprise Java in JavaWorld's Enterprise Java section.

  • Print
  • Feedback

Resources

More