If You Know JSF,You Know
    Portals and Portlets
           By: Wesley Hales

           June 1st, 2010
@wesleyhales         vimeo.com/wesleyhales

• JBoss Portlet Bridge Project Lead
• RedHat’s representative on JSR-301 & 329...
Take Aways

• Understand what a portlet is and does
• Learn how a JSF application maps to the
  portlet API
• Best practic...
Portlets of Yesterday

• “... looking for a strong Portal Developer
  with experience”.
• JSP’s with awkward portlet API m...
Portlets Just Got Easier
• JSF developers are portlet developers (and
  most don’t even know it)
• With a JSF portlet brid...
Quick Portlet
               Overview
Portlets are...

     • Spec driven (168 & 286)
     • Rendered markup fragments on ...
Portlet UI
Portals & Portlets

• Portals integrate
  services across
  organizational boundries.
  i.e. - SSO, collaboration and soci...
If you really want to
          know...
• Servlets vs. Portlets
 • Wrapping your head around 2 (or more)
    requests.
 • ...
What is a Bridge, and why do we
           need one?

•   There are many different bridges to handle
    different web app...
Cool Usecases?
• Most larger companies have a need for a
  portal
• Multiple teams working in parallel
• Blended content w...
• Allows JSF 1.2, JSF 2, RichFaces, and Seam
  to run as portlets
• Extensions and components
• Backed by a healthy commun...
Portlet Container

  JSF Portlet                                                                            How the Portle...
Servlet Processing

• Ability to (simultaneously) process
  incoming faces requests via servlet
  container
• Good for deb...
JSF 1.2 Portlets
• Add a portlet.xml and the portlet bridge
  jars to your current JSF application.
• Use the archetype fo...
Working with the portlet API
           through JSF
Environment Based Resolution:

    • FacesContext.ExternalContext (i.e...
Portlets
Supports all Richfaces components (i.e. - upload,
push, etc...)



Automatic script wrapping (via web.xml)
Portlets
*Detailed example of Portlet Application Scope: http://vimeo.com/11484018

Simple SSO config between portal and se...
JSF 2.0 Portlets
• JSF 2 is currently available as “Tech Preview”
• Add a portlet.xml and the portlet bridge jars
  to you...
Sending Events
              Portlet Container

                 Seam Portlet             JSF Portlet


                  ...
Demo
Public Render Parameters
  • Simple way of providing a parameter which
       can be consumed by any portlet
  • BridgePub...
Changing Portlet Modes Using
      Faces Navigation
Rendering Multiple JSF Apps on
        One Page ?!?
• The bridge takes care of JSF + Portlet
  namespacing
• Shared custom...
Other Need to Knows
• Clearing the view history between modes
• Ajax Error Handling
• Redirecting to an External Page or
 ...
Getting Started
• Maven Archetypes - bit.ly/9CMKZG
• Eclipse / JBoss Tools support
Getting Involved

• User Forums
• Articles & How Tos
• Jira - Add your enhancement or try to
  handle some created issues
Useful Links

• http://jboss.org/portletbridge
• http://vimeo.com/wesleyhales/videos
• http://jboss.org/gatein
If You Know JSF, You Know Portals and Portlets
If You Know JSF, You Know Portals and Portlets
If You Know JSF, You Know Portals and Portlets
If You Know JSF, You Know Portals and Portlets
If You Know JSF, You Know Portals and Portlets
If You Know JSF, You Know Portals and Portlets
Upcoming SlideShare
Loading in …5
×

If You Know JSF, You Know Portals and Portlets

8,242 views

Published on

Presented at Jazoon 2010 on June 1st

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
8,242
On SlideShare
0
From Embeds
0
Number of Embeds
28
Actions
Shares
0
Downloads
202
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

If You Know JSF, You Know Portals and Portlets

  1. 1. If You Know JSF,You Know Portals and Portlets By: Wesley Hales June 1st, 2010
  2. 2. @wesleyhales vimeo.com/wesleyhales • JBoss Portlet Bridge Project Lead • RedHat’s representative on JSR-301 & 329 • RichFaces contributor & GateIn core dev • Side projects include: wesleyhales.com, Firefox Anthem
  3. 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. 4. Portlets of Yesterday • “... looking for a strong Portal Developer with experience”. • JSP’s with awkward portlet API mapping • Yet another lifecycle to learn
  5. 5. Portlets Just Got Easier • JSF developers are portlet developers (and most don’t even know it) • With a JSF portlet bridge, you’re not required to learn the underlying portlet development concepts or APIs. • But there are a few things that are nice to know ;)
  6. 6. Quick Portlet Overview Portlets are... • Spec driven (168 & 286) • Rendered markup fragments on a page. • Different window modes like edit, help, and view
  7. 7. Portlet UI
  8. 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. 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. 10. What is a Bridge, and why do we need one? • There are many different bridges to handle different web applications. • Wicket • Seam • Spring MVC • JSF • Struts • PHP
  11. 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. 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. 13. Portlet Container JSF Portlet How the Portlet Bridge manages the Faces single request lifecycle Resource Request Event Request Render Request Action Request *See section 5.1 of the Bridge 2.0 spec for full details Faces Engine Apply Bridge Request Restore Process Request Processing View Validation Values Update Invoke Render Model Application Values
  14. 14. Servlet Processing • Ability to (simultaneously) process incoming faces requests via servlet container • Good for debugging
  15. 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. 16. Working with the portlet API through JSF Environment Based Resolution: • FacesContext.ExternalContext (i.e - dispatch(), encodeActionURL(), getResponse() ...) • EL Variables - (i.e - portletConfig, renderResponse, portletPreferences, ... )
  17. 17. Portlets Supports all Richfaces components (i.e. - upload, push, etc...) Automatic script wrapping (via web.xml)
  18. 18. Portlets *Detailed example of Portlet Application Scope: http://vimeo.com/11484018 Simple SSO config between portal and seam app (via components.xml) Portlet Application Scope
  19. 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. 20. Sending Events Portlet Container Seam Portlet JSF Portlet Event • Bridge provides its own BridgeEventHandler • Standard Event configuration in portlet.xml • Can receive or send events from any portlet *Detailed example of Sending Events: http://vimeo.com/11484018
  21. 21. Demo
  22. 22. Public Render Parameters • Simple way of providing a parameter which can be consumed by any portlet • BridgePublicRenderParameterHandler • Map parameters to any BackingBean member (via faces-config.xml) *Full example of working with Render Params here: http://vimeo.com/11484018
  23. 23. Changing Portlet Modes Using Faces Navigation
  24. 24. Rendering Multiple JSF Apps on One Page ?!? • The bridge takes care of JSF + Portlet namespacing • Shared custom js will require it’s own NS • Getting the bridge NS:
  25. 25. Other Need to Knows • Clearing the view history between modes • Ajax Error Handling • Redirecting to an External Page or Resource bit.ly/9fjktn
  26. 26. Getting Started • Maven Archetypes - bit.ly/9CMKZG • Eclipse / JBoss Tools support
  27. 27. Getting Involved • User Forums • Articles & How Tos • Jira - Add your enhancement or try to handle some created issues
  28. 28. Useful Links • http://jboss.org/portletbridge • http://vimeo.com/wesleyhales/videos • http://jboss.org/gatein

×