How to use Component class in JSF2
I'm developing custom jsf2 component, that has an datasource attribute. There are some operations on datasource, that belongs to VIEW. For instance, th开发者_开发百科ere is a method that returns some image for column header, if the table is sorted by the column, and other image if it doesn't. In JSF1, each component has its Java class, extending UIComponent, so I can implement such methods there. However, I see that in JSF2, component class is created automatically from xhtml, so I doesn't know how to add methods to it. Can anybody explain me how to do it? s it possible to use both composite component and component class in one component?
In JSF 2 you can create component classes in Java in the same way you do in JSF 1 (the API may have changed a bit, but it is mostly the same. For example, look at http://weblogs.java.net/blog/driscoll/archive/2009/10/09/jsf-2-custom-java-components-and-ajax-behaviors
精彩评论