Profile

Recent Bloggers

Neil Griffin Posts: 20
Stars: 59
Date: 7/30/10
Jorge Ferrer Posts: 34
Stars: 157
Date: 7/30/10
Alice Cheng Posts: 155
Stars: 13
Date: 7/29/10
Ronald Sarayudej Posts: 118
Stars: 275
Date: 7/29/10
Stephen Wilburn Posts: 1
Stars: 3
Date: 7/28/10
Samuel Liu Posts: 3
Stars: 2
Date: 7/27/10
Juan Fernández Posts: 8
Stars: 22
Date: 7/26/10
Ray Augé Posts: 46
Stars: 201
Date: 7/24/10
Brian Chan Posts: 33
Stars: 214
Date: 7/23/10
Nate Cavanaugh Posts: 33
Stars: 115
Date: 7/20/10

Blogs

Working with JSF's <f:convertDateTime /> and java.util.Date

During a recent class I taught on ICEfaces, one of my students asked me why the calendar was often one day off from what got posted back to the model managed-bean setter.

For example:
// Facelets XHTML Markup:
<ice:selectInputDate value="#{modelManagedBean.dateOfBirth}">
    <f:convertDateTime pattern="MM/dd/yyyy" />
</ice:selectInputDate>

// Java Code
import java.util.Date;
public class ModelManagedBean {

  private Date dateOfBirth;

  public Date getDateOfBirth() {
    return dateOfBirth;
  }

  public Date setDateOfBirth(Date dateOfBirth) {
    SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy hh:mm z");
    // The value printed here during postback was often wrong by 1 day
    System.out.println("dateOfBirth=" + dateFormat.format(dateOfBirth));
    this.dateOfBirth = dateOfBirth;
  }
}


Basically, the JSF DateTimeConverter Javadoc states that if the timeZone attribute is not specified, then the default is GMT. But when you create an instance of java.text.SimpleDateFormat, the default TimeZone is equal to TimeZone.getDefault() which (for me) was EST. So the solution I explained to my students was to make sure we were comparing apples-to-apples the whole way through, by using GMT for the SimpleDateFormat printing, like this:

dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));

And of course, I think it's the recommended practice to run your application server JVM in GMT. That would eliminate the problem entirely. But when you're using Eclipse and Tomcat for development, that's typically not the case.

 

JSF 2.0 Complete Reference, with JSF Portlet Appendix

 

JSF 2.0 Complete Reference with JSF Portlet Appendix

I'm pleased to announce the new JSF 2.0 Complete Reference book by Ed Burns and Chris Schalk, published by McGraw-Hill. During the planning stages, Ed asked me to be a contributing author and help bring the first edition of the book up-to-date with JSF 2.0, and also to write a JSF Portlet Appendix.

As listed in the Table of Contents, Appendix A discusses the following Topics:

  • Overview of Portlet 1.0 and 2.0
    • Portlet Lifecycle
    • Portlet Modes
    • Portlet Window States
    • Portlet Preferences
    • Inter-Portlet Communication
  • JSF Portlet Development
    • JSF Portlet Bridges
    • JSF Portlet View Handlers
    • JSF ExernalContext and the Portlet API
    • JSF and Portlet Preferences
    • JSF and Inter-Portlet Communication
  • ICEfaces Portlet Development
    • ICEfaces Ajax with Partial Submit
    • ICEfaces Direct-to-DOM RenderKit
    • The ice:portlet Tag
    • ICEfaces 1.x Portlet Bridge
    • ICEfaces 1.x D2DFaceletViewHandler
    • ICEfaces 1.x and Portlet Window States
    • ICEfaces Portlets and Concurrent DOM Views
    • ICEfaces 1.x Extended Request Scope
    • ICEfaces Ajax Push and Inter-Portlet Communication
    • ICEfaces Themes and Portal Themes
    • ICEfaces Themes and Liferay Themes
    • ICEfaces Ajax Bridge and Liferay Portal
    • ICEfaces Portlets and Liferay Request Attributes
  • PortletFaces
    • Downloading PortletFaces
    • PortletFacesContext
    • PortletFaces Tags
    • PortletFaces and Portlet Preferences
    • PortletFaces and Expression Language Additions
    • PortletFaces and Localization
    • Liferay Language Portlet Integration
    • Improved Integration Between Liferay and ICEfaces 1.x

This week (Feb 2nd to Feb 5th) Ed Burns & Chris Schalk will be helping to answer questions about the new book at JavaRanch. In addition, JavaRanch will be giving away a free copy of the book.

Finally I'd like to express my gratitude to Liferay, ICEsoft, Mimacom, and Triton for their generous support in making the JSF Portlet Appendix possible.

JSF 2.0 + ICEfaces 2.0 + Portlet 2.0 = The PortetFaces Bridge

UPDATE#1: PortletFaces Bridge webinar took place on Thursday, Feb 11 2010 AD. Click here to view the PDF slideshow.

UPDATE#2: The source code is at Alpha1 status and can be checked out from SVN here:

I'm working on a new project called the PortletFaces Bridge which will enable the use of JSF 2.0 within Portlet 2.0 compliant portals like Liferay 5.x. The bridge implements a subset of the features available in JSR-329. Although the JSR-329 standard defines an API for a JSF 1.2 + Portlet 2.0 bridge, the PortletFaces Bridge is targeting JSF 2.0. Additionally, the bridge will facilitate usage of ICEfaces 2.0 within Liferay Portal.

Project Status as of January 27, 2010 AD:

  • I have a sample JSF 2.0 portlet developed that is using the new PortletFaces Bridge.
  • HTTP GET of portal page: bridge runs the portlet RENDER_PHASE, which runs the JSF lifecycle+renderResponse and the portlet renders fine in the browser.
  • HTTP POST after clicking h:commandButton: bridge runs the portlet ACTION_PHASE, which runs the JSF lifecycle. It then runs the portlet RENDER_PHASE, which runs the JSF renderResponse and the portlet renders fine in the browser.
  • RESOURCES: When using the new JSF 2.0 "resource" mechanism (like for downloading the "jsf.js" JavaScript file), the bridge correctly invokes the portlet RESOURCE_PHASE, which invokes the JSF 2.0 ResourceHandler and the contents of the requested resource are correctly delivered back to the browser.
  • AJAX: After tabbing-out of a field, the JSF 2.0 "jsf.js" JavaScript code correctly invokes the portlet RESOURCE_PHASE, which runs the JSF lifecycle+renderResponse, and correctly applies the DOM updates in the browser. Currently it uses the new JSF 2.0 <f:ajax /> tag to do Ajax requests. BTW I had to fix a problem in Mojarra to make this work -- I'm in contact with the Mojarra team and they're working on fixing it for the upcoming 2.0.3 release.
  • What's left: There's a bunch of little things -- loose ends that need to be coded up. Stuff like:
    • Testing of ICEfaces 2.0 WITHOUT the <f:ajax /> tag
    • Testing of ICEfaces 2.0 components (compatibility components)
    • Testing of ICEfaces 2.0 Ajax Push
    • After navigation-rules fire, need to compute the next JSF viewId to render
    • Detecting portlet mode changes (VIEW MODE, EDIT MODE, HELP MODE)

The goal is to have an Alpha version ready for use by the time the webinar happens on Thursday, Feb 11 2010 AD. The bridge will be be an open source project and be available for download from the http://www.portletfaces.org website.

 

Speaking at JSF Summit: Social Networking with ICEfaces and Liferay

 

I'll be speaking at JSF Summit 2009.

The event is being held from 12/1 - 12/4

Location:
Loews Portofino Hotel @ Universal Orlando
5601 Universal Boulevard
Orlando, FL 32819

 

Session Title:

Social Networking with ICEfaces and Liferay

Session Abstract:

This talk will demonstrate how easy it is to develop social networking portlets with ICEfaces and Liferay. Attendees will learn the fundamental techniques through code walkthroughs of ICE Friends and ICE Chat portlets, leveraging Facelets composite components and real-time status updates via Ajax Push.

Social networking is a natural addition to the portal, already a meeting place for applications. Diverse systems and users can be brought together for web-based communication and collaboration. When introduced to Ajax Push, portlets provide real-time communication features such as presence, chat, and new forms of application-specific interaction. Attendees will also learn about PortletFaces, a new open source project that enables a more JSF-centric approach to building portlets that use vendor-specific features of Liferay Portal.

PortletFaces Webinar

I'm pleased to announce that the PortletFaces project has now been formally established and can be found here: http://www.portletfaces.org

An ICEsoft+Mimacom webinar has been scheduled for Thursday October 29, 2009:

4PM - 5PM CET
11AM - 12PM EDT
8AM - 9AM PDT

Here's the registration link: https://www1.gotomeeting.com/register/741441337

I'll be conducting the webinar along with Micha Kiener of Mimacom, sponsor of the Edoras Framework.

The goal the PortletFaces project is to make it easier to develop JSF portlets that run within Liferay Portal. The project contains a wealth of features that expose the standard features of the Portlet 2.0 API and vendor-specific features of Liferay in a way that is natural to JSF development. It also provides improved integration between Liferay and ICEfaces 1.x portlets.

The beginnings of PortletFaces can be traced back to a forum post made by community member Joel Kozikowski back in May of 2007. Joel donated his code to Liferay and we began to work on the project together under Liferay incubation. Since then, PortletFaces has been adopted by Mimacom AG and is a sub-project of the edoras framework.

I'd like to personally thank Joel and the other contributors for their valuable additions to PortletFaces:

  • Micha Kiener
  • Atul Patel
  • Ed Shin
  • Stefan Niederhauser

Also my personal thanks to Liferay for sponsoring PortletFaces during incubation, ICEsoft for all the terrific support, and thanks to Mimacom for adopting the project.

Finally, I'd like to thank Triton's Steve Groninga for coming up with the PortletFaces project logo.

Documentation for PortletFaces can be found here: http://www.portletfaces.org/documentation

Showing 1 - 5 of 20 results.
Items: 5
Page: of 4