If You Know JSF, You Know Portals and Portlets

Embed Size (px)


Presented at Jazoon 2010 on June 1st

Text of If You Know JSF, You Know Portals and Portlets

  • 1.If You Know JSF,You Know Portals and PortletsBy: Wesley Hales June 1st, 2010

2. @wesleyhales vimeo.com/wesleyhales JBoss Portlet Bridge Project Lead RedHats representative on JSR-301 & 329 RichFaces contributor & GateIn core dev Side projects include: wesleyhales.com, Firefox Anthem 3. Take Aways Understand what a portlet is and does Learn how a JSF application maps to the portlet API Best practices for working with multiple JSF apps within a portal environment 4. Portlets of Yesterday ... looking for a strong Portal Developer with experience. JSPs with awkward portlet API mapping Yet another lifecycle to learn 5. Portlets Just Got Easier JSF developers are portlet developers (and most dont even know it) With a JSF portlet bridge, youre not required to learn the underlying portlet development concepts or APIs. But there are a few things that are nice to know ;) 6. Quick PortletOverview Portlets are... Spec driven (168 & 286) Rendered markup fragments on a page. Different window modes likeedit, help, and view 7. Portlet UI 8. Portals & Portlets Portals integrate services across organizational boundries. i.e. - SSO, collaboration and social, etc... Portlet windows deliver the data to the user and can come from various sources - wars/ears/wsrp. 9. If you really want to know... Servlets vs. Portlets Wrapping your head around 2 (or more) requests. Portlets generate a page with multiple portlet windows that can be rendered multiple times. All links are generated by the portlet api 10. What is a Bridge, and why do weneed one? There are many different bridges to handle different web applications. Wicket Seam Spring MVC JSF Struts PHP 11. Cool Usecases? Most larger companies have a need for a portal Multiple teams working in parallel Blended content with legacy apps Communication between 2+ wars on same page leverage existing investments 12. Allows JSF 1.2, JSF 2, RichFaces, and Seam to run as portlets Extensions and components Backed by a healthy community, documentation, screencasts, and archetypes 13. Portlet ContainerJSF PortletHow the Portlet Bridgemanages the Faces single request lifecycle Resource Request Event RequestRender Request Action Request*See section 5.1 of the Bridge 2.0 spec for full details Faces EngineApplyBridge Request Restore ProcessRequestProcessingViewValidation Values UpdateInvokeRender ModelApplication Values 14. Servlet Processing Ability to (simultaneously) process incoming faces requests via servlet container Good for debugging 15. JSF 1.2 Portlets Add a portlet.xml and the portlet bridge jars to your current JSF application. Use the archetype for reference 16. Working with the portlet APIthrough JSF Environment Based Resolution: FacesContext.ExternalContext (i.e - dispatch(),encodeActionURL(), getResponse() ...) EL Variables - (i.e - portletCong,renderResponse, portletPreferences, ... ) 17. Portlets Supports all Richfaces components (i.e. - upload, push, etc...)Automatic script wrapping (via web.xml) 18. Portlets *Detailed example of Portlet Application Scope: http://vimeo.com/11484018Simple SSO cong between portal and seam app (via components.xml) Portlet Application Scope 19. JSF 2.0 Portlets JSF 2 is currently available as Tech Preview Add a portlet.xml and the portlet bridge jars to your current JSF 2 application. Use the archetype for reference 20. Sending Events Portlet Container Seam Portlet JSF Portlet Event Bridge provides its own BridgeEventHandler Standard Event conguration in portlet.xml Can receive or send events from any portlet*Detailed example of Sending Events: http://vimeo.com/11484018 21. Demo 22. Public Render Parameters Simple way of providing a parameter whichcan be consumed by any portlet BridgePublicRenderParameterHandler Map parameters to any BackingBean member(via faces-cong.xml)*Full example of working with Render Params here: http://vimeo.com/11484018 23. Changing Portlet Modes Using Faces Navigation 24. Rendering Multiple JSF Apps on One Page ?!? The bridge takes care of JSF + Portlet namespacing Shared custom js will require its own NS Getting the bridge NS: 25. Other Need to Knows Clearing the view history between modes Ajax Error Handling Redirecting to an External Page or Resourcebit.ly/9fjktn 26. Getting Started Maven Archetypes - bit.ly/9CMKZG Eclipse / JBoss Tools support 27. Getting Involved User Forums Articles & How Tos Jira - Add your enhancement or try to handle some created issues 28. Useful Links http://jboss.org/portletbridge http://vimeo.com/wesleyhales/videos http://jboss.org/gatein