File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes UIDateInput Custom Component Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "UIDateInput Custom Component" Watch "UIDateInput Custom Component" New topic

UIDateInput Custom Component

Prash Singh
Ranch Hand

Joined: Aug 23, 2009
Posts: 103

Dear all,

I am new to JSF world. I am using JSF in Action book for JSF reference.
In their Custom Component Development chapter, they have created a custom component UIDateInput.
This component creates three html select option tag pairs filled with month, year and day parts of a date.

This component uses the java.util.Date for value attribute.

But I want to add more attributes like binding, disabled ,styleclass to this component.
But I am unable to do so..
Also there is ValueBinding and ValueExpression issues.

Please help me through this....
I am really having a tough time in dealing with this component.

Waiting for replies.
Thanks In Advance.

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

The easiest way to do this is to subclass an existing component that already has these features.

Just as a warning, however, creating a custom JSF binary component is something you should only attempt as an absolute last resort. JSF components started out as an extended JSP tag construct but they quickly got lost and the results these days are a mish-mash resulting from blending about 3 different and occasionally conflicting concepts, with documentation that's generally poor and out of date. For most cases, it's a lot easier to build components at the XML source level instead.

An IDE is no substitute for an Intelligent Developer.
Prash Singh
Ranch Hand

Joined: Aug 23, 2009
Posts: 103

Thanks for your reply Tim.

But in my work area I am restricted to use any other external component library.
So for handling date fields , I need to have some kind of custom component which can reflect changes in date fields.

The example I have been through in "JSF in action" displays a date in three different parts and is pretty cool.
But I am just not able to get its binding attribute working.

I need help in this regard.
Sorry if it sounds redundant.
I agree. Here's the link:
subject: UIDateInput Custom Component
jQuery in Action, 3rd edition