Red Hat

In Relation To JSF

In Relation To JSF

RichFaces 4.0.0.Milestone 4 Released!!

Posted by    |       |    Tagged as JSF Rich Faces Seam

The RichFaces team is pleased to announce that 4.0.0.Milestone 4 is now released!! You can get the distribution at our project site's download page, or if you are using maven you can follow our: How to add RichFaces 4.X to Maven Based Project wiki page. We are already hard at work on the final 4.0 milestone release which is due near the end of December. This means that in January we'll start in on the CR releases and hope to get a final release of 4.0 out in February.

Updates

As with all of our milestone releases we have added new components, stability, and functionality. Below is a summary of the main items, and you can review the complete list in our Jira Release Notes

  • New components such as inplaceSelect, select, calendar, tooltip, and tree!!
  • Great progress on Client Side Validation. You can start using these components now, but will be using Ajax requests for validation until the M5. The major parts of client/server side functionality are completed, and need to be integrated, and flushed out in milestone 5.
  • a4j:push redesigns are completed. We have switched to advanced Comet implementation and targeted JMS integration. We still need to wrap up documentation, and samples, but the component is there. For a jump start until those are ready you can review here and the developer sample in svn
  • We've also improved the functionality of the CDK, and continued stabilization work for our core, and migrated components!
  • Our RichFaces Showcase demo has also been updated with new components, and features.

We would be happy if you can give this release a try, and let us know how it goes. The good, the bad, and the bugs….

We Need Your Help!!

This is the time when open source projects like RichFaces really need the help of their communities. In order to get 4.0.0.Final stabilized and ready to go for everyone we need everyone to take these later milestone releases for a spin. We've already had some great feedback from users on Milestone 3, and really want to keep this going. Believe me, this type of feedback makes all the difference!!!

To those who have tried out previous release, thanks!!

Next Up Milestone 5

Milestone 5 will be the last milestone release for the RichFaces 4.0!! This means we are going to be wrapping up new component development before going into full fledged hardening mode for the CR releases. The component we plan to add are outlined in RF-9332. For a complete list of jira's planned see our Milestone 5 Jira page. Any component that did not make milestone 5 will be pushed out of the initial 4.0.0 release.

As we are a very open project if you find an issue, have any comments or ideas please let us know through our forums, or our project jira. See our Project Calendar and the Meeting Information page for more details, agendas, and minutes.

[Project Site] [Downloads] [JIRA] [User Forums] [Design Forums] [RichFaces Twitter]

When will JSF have a new JSR & official Expert Group

Posted by    |       |    Tagged as JSF Rich Faces Seam

The RichFaces and Seam teams are nothing if not passionate about community, open source, and working with standard bodies like the Java Community Process (JCP). That is one of the reasons that Oracle/Sun's decision to disband the JSF expert group (JSR-314) with no successor JSR filed under which to develop future revisions of JSF is disappointing. Dan Allen summed up JBoss/Red Hat's position quite clearly in his letter to the JSR-314 public mailing list. While we want to continue supporting the JSF specification, not having an official JSF and EG, along with the intellectual property and governance guarantees this brings, makes this very difficult.

I want say something very clearly. I believe that the individual engineers are doing the best they can with their current priorities and constraints. They are still posting to the JSR-314 open mailing list, which you can view using the JBoss jsr-314-open-mirror), and asking for comments and patches. The RichFaces and Seam teams will also work within our current constraints and will work to resolve some of the core issues that will impact key features of JSF 2.0. While at the same time we will be pushing for a new JSR to be formed. Unfortunately, due to the above mentioned issues, JBoss's participation is limited, although we are fully prepared to contribute if the correct environment is present. When it isn't, we can only expect the spec leads to take on board our issues and push them.

As an example of the above, one of the major goals of the JSF specification is to enable component libraries to interoperate with each other within the same application, and ideally the same page. As component libraries develop to the new specification, and add features, we are finding areas where the specification needs to be updated. As there is no official JSR, and the specification priorities are driven by the RI priorities, some of these issues have been pushed to future versions of the specification ( with an unknown timeline ). Take for example #658 which deals with a problem with the PartialViewContext and how component libraries can extend it without breaking other component libraries. The RichFaces team has provided a draft patch to resolve this (thanks Nick) , however due to timing this will not be included in JSF 2.1.

With no known timeframe, JSR or expert group in place for JSF 2.2+ the Seam and RichFaces projects will continue to give our communities the features and functionality they expect, but in some cases this will need to be outside of the JSF specification. For example View Actions will be implemented by Seam Faces instead of being part of the specification for now. Richfaces has and will continue to reach out to other component libraries such as IceFaces, PrimeFaces, etc… to kick off discussions on how to address these issues outside of the specification. Hopefully we'll be able to deliver the interoperability that was promised, while prototyping updates for future versions of the specification.

Let's hope this situation can be resolved as soon as possible!

RichFaces 4.0.0.Milestone3 Released!!

Posted by    |       |    Tagged as JSF Rich Faces Seam

The third milestone release of RichFaces 4.0 is now available!! With this release we have added a few new components, GAE support, and more. As before you can download the distribution at our RichFaces download page. The RichFaces-4.0.0.M3 distribution has everything you need to get started. Check out the readme.txt files for any details, or dependencies. If you are a maven user you can follow the instructions here: How to add RichFaces 4.X to Maven Based Project.

As you may have seen several of the RichFaces team presented and attended JavaOne. During our talks we announced and discussed several items that are starting to emerge in milestone3. There was a lot of interest in the new client side validation support that will bring bean validation all the way to the browser. Imagine the scalability impact if you can avoid server hits for validation! We also discussed support of JSF 2.0 and RichFaces 4.0 on cloud based hosting like GAE. With more to come...

Updates:

The 4.0.0.M3 Release Notes contains all the details, and specific issues. We would be happy if you can give this release a try, and let us know how it goes. The good, the bad, and the bugs….

Next Up Milestone 4

For Milestone 4 we will be working on more components like finalizing client side validation, calendar, tree, fileupload, and more. There are also going to be some updates to our Push components that should be exciting to see. We are looking at a November release for Milestone 4.

If we are missing your favorite component, or if you find an issue please let us know through our forums, or our project jira. You can also see our current plans by following the 4.0.0.Milestone4 project in jira, or dropping by one of our public IRC meetings. See our Project Calendar and the Meeting Information page for more details, agendas, and minutes.

[Project Site] [Downloads] [JIRA] [User Forums] [Design Forums] [RichFaces Twitter]

JSF 2.0 CookBook by Anghel Leonard review

Posted by    |       |    Tagged as Discussions JSF

Overview

Actually I’m a fan of this kind of book, as in my opinion they are useful for beginner and experienced developers. It’s always good to have it to be able to review all the possible solutions for concrete case and start quickly with prototyping. So that’s why I accepted Packt Publishing proposal to review JSF 2.0 CookBook by Anghel Leonard with pleasure.

Finally I’ve finished reading it and now wanting to share my opinion about its advantages and problematic parts. From the beginning I want to give quick overview of common points and then to go through the whole book to highlight recipes I really liked and propose some kind of errata for other ones.

Positives

It has a really good structure for recipes! I’m able to open any recipe without going through some overviews about conventions and environments info and just use the recipe! Every recipe contains description of technologies and tools used. Also it points us to the archive with complete application and has good explanations of key points for sure. Many of the JSF world FAQ’s are covered well in the book and most of them could be picked by just copying the sample code from book applications.

Also need to highlight that in most cases – all the alternatives for implementation of the same use-case are covered. That allows the user to choose most convenient way for him!

And I believe that in general – that book really worth a place on your shelf because could answer at many common questions or at least provide some pointers about where to check for the answer.

Some criticism

Well there is always some place for critical words. But let that criticism not to confuse the author and the guys who plans to read it. I just want to highlight some points which I believe will be useful for author in future and will make the readers to go through some problems easier.

Most of the examples show clean and useful samples – but sometimes author uses just “hello world” style for complex cases and the developer could miss the points or underrate the feature importance. That the main problem of some recipes. And I’m not sure if recipes where there are no code samples at all (there are few present) should be in such book.

Author uses JSP through the entire book. However – it’s deprecated in 2.0 and was not really popular in 1.2 after facelets came to the scene. It’s not a big problem for sure – but in some cases some important info missed. For example – custom component recipes – says about TLD descriptors but has nothing about taglib’s needed for the component.

So let’s go through the book shortly. Again – critic words which could appears there – only pointer for the readers to pay their attention more and to the author – to consider in future.

Going through

Now let's look some closer to book content.

Conversion/Validation chapters

Both chapters are described really well and will be useful for the developers who need to get a quick start with that JSF area. Most cool points which I like to see included into JSF CookBook, as they are asked much across the community – converters with passing parameters, validation using regular expressions with useful list of common expressions, JSR 303 recipes for validators groups and calling the validation from your java code.

Some Problems
  1. For better understanding - RichFaces bean validator recipe @NotEmpty case could be slightly extended with information that in general JSF 1.2 not validates the empty inputs at all. So need to mention that it will work only using RichFaces framework (which provides standard input renderers extensions to support null-values validation). Not just to say how cool it is to use RichFaces J but just to make sure that developer will realize where the problem is if will try the validation without RichFaces and it will stop working.
  2. Author missed to highlight the difference between BeanValidator and AjaxValidator in RichFaces. They described as completely similar. Most important that should be mentioned that ajaxValidator – is a combination of Ajax Support and Bean Validator.

File Management

This provides a good overview of all the component libraries which provides solutions for that topic. All the samples covered well and could be just picked to real application from the samples. The only minor problems lack of samples for the solutions without usage any additional libraries (download, export).

Security

The recipe contains good overview of JSF security and Acegi. But in my opinion chapter lacks some basic information and could be slightly extended with the pure JSF solutions.

Custom Components

This chapter is one which caused most of my questions. It’s sad as custom components creation – one of the most important topics in JSF – so I paid much attention to that chapter. Overview is short and really clear and looks really good as an introduction for the beginner... However screenshot of the lifecycle contains basic mistake. The “encoding” and “decoding” labels was put to wrong phases opposite to the places where them should be.

“EmailInput” – not looks as a best example of custom component. As written at all the classical JSF books resources - “before creation of the new component – double-check that you can’t achieve the result via some composition”. Even considering that the author probably wanted to gave really simple overview – the question remains then - why he was need to override renderer methods of the input? Standard input renderer should be enough there and it’s a way to confuse developer as he could decide that extension of the components still requires from him to override base functionality every time.

“ImageViewer” – again maybe it was better to extend the graphicImage component instead of writing from scratch.. And the code not looks really clean especially in adding Ajax capabilities section where the new JS not listed normally but only included in renderer as escaped String.

“ProxyId library”. Need to admit that I never heard about this interesting extension. But that probably related to the facts that RichFaces already provides the rich:clientId, rich:element, rich:findComponent and other functions to perform different operations on components using their short id’s. And not a section problem but note for me to check - author not listed but interesting to know how that proxyId will works in iteration components.

“Accessing resources from custom component”. From my point of view – that is most useless recipe in that chapter... I believe that we should not believe that JSF beginner – could understand the difference of approaches using just brief descriptions. In order this section to become recipe – it should provide the code and explanations based on it.

“RichFaces CDK”. At first small notes:

  • For those who will read the book only now – the settings for maven – has been changed after we switched to JBoss nexus repository.
  • Author should explicitly define that this shows CDK from RF 3.3.3 in action. As in 4.x it is completely redesigned and not compatible with the old one.

“Getting Ready” in “RichFaces CDK” contains the info on manual folder and pom.xml creation. However it could be done by archetype as written in our CDK reference. “How to do it” – at first asking the user to type the command from the screenshot – looks not good.. At least for big 3-row command. J The rest of the recipe in general explained well. Minor note - project could be easily created by archetype instead of manual sample creation.

“Composite Components” section explains the process really well and provides short but good samples.

“Mixing dojo and JSF”. In general – the recipe will work well for somebody who needs to get the idea about how to use dojo widgets in JSF components. But I’m confused with the facts that author proposes just output attributes needed by dojo using component but include all the resources on the samples page. It looks like not very maintainable solution.

AJAX in JSF

“DynaFaces” – recipe which unfortunately is not described well in my opinion. Just “drag and drop some components and then add Ajax transaction” – is not enough to understand who could need those recipe and why he need dynaFaces. Why it’s still useful – self-descriptional application archive.

“Tomahawk suggestAjax” and “A4j Ajax” recipes are clean and well described.

“Writing reusable AJAX components” recipe contains really weird issue – there is no Ajax which is mentioned in section name J. Just common spinner component optimized for usage of multiple instances on the page.

Main issue of that chapter on my opinion – lack of really common tasks recipes... E.g. how to perform optimized Ajax editing of huge tables, how to organize wizards, how to lazy load data after page rendered and some more... Simple cases are useful for sure as shows basics... But the developers has to implement much more complex issue in real enterprise applications and that questions appears on different community forum continuously

Localization

The chapter covers all the main cases which could be needed by the developer and recipes look clean at most.

Let’s highlight some samples there. “Accessing message resources from a class” – pretty good recipe and looks clean while you looking for the most important Helper class which performs obtaining the localized String. Minor problem there – it contains no result screenshots and actual properties listing – so not really easy to get what the user will see in the result. Need to start application from examples archive to check. Selection a timezone in JSF 2.0 – good pointer for the reader to possible problems. Even having no recipe author at least pointed the developer to the fact that he should pay attention and check for additional information. Displaying Arabic characters recipe – again uses JSP only.. But what about facelets? There are some other tricks existing and it’s knowledge needed by the developer more.

JSF Images, CSS and JS

“Injection of CSS“ recipe are we really talking about styling here? So why do I see only that dry source code and not at least a single image of the beautiful page created? :) It's could be not easy for the beginner to imagine what did the author achieved there (the beginner could not know the rules to apply those attributes for the component) without going again to examples archive.

“Dynamic CSS“ - I believed that there I will see how to use EL in CSS stylesheets :) B.t.w. frequently asked use-case which could be shown there - highlighting in the table cells/rows using styles which returned according to row model type, (e.g. Important or LowPriority). But the sample there unfortunately looks more static.

“Java Script injection“ well simple and clean example gives some ideas how I could apply my JS knowledge in JSF. Just working with JSF hidden fields section confuses me as there is nothing about hidden fields. (Actually I expected h:inputHidden usage) “Passing parameters“ could become also really useful section – but the examples miss some more real usage cases. “Opening popups using JSF and JS“ - looks good and answers the initial question really fine..

“Rss4jsf“ – Thanks for the pointer :). I've missed that framework and plan to look though now. It looks clean and easy to use. “Resources in JSF 2.0“ – it would be good to have a few words about access from Java objects. But proposed descriptions and samples of usage in the views looks clean and self-explanatory.

JSF Managing and testing

JSF Unit – want to highlight great overall descriptions, good samples and list of most used API. The only charts usage – not really related to testing, and in general contains no recipe but just pointer to library site… But that not really make the whole chapter less useful.

Facelets

Almost nothing to say – but that because the chapter has no problems in general and well written :)

Want only to highlight “composition component for JSF 2.0” section. It’s really good sample. But the main problem – for some reason (seems because a section name) I expected that it will be about composite component especially considering that the author mentions JSF 2.0. And it’s actually about custom tag from 1.2. But as far as I realized that that is just custom tag recipe and not actual composite component I re-read it and want to admit that it’s pretty good for that topic.

“Passing action” – really good to see there. It’s most weird issue in Facelets 1.x and most frequent question from the guys who creating custom facelets.

JSF 2.0

Good and useful chapter again – so let’s just look to some concrete samples which I want to pay readers attention.

Why we need Pretty Faces to create bookmarkable URLs in 2.0? It’s JSF 2.0 core feature. This just seems placed in wrong chapter. It was good for 1.2 when GET requests were not supported out of the box. Later we will found section about JSF 2.0 navigation enhancements and view parameters usage. In general the overview of them written fine. Just already mentioned problem - it loses some real case to show its coolness (it could be greatly used in common case of product list – product details navigation).

Mixing JSF and other technologies.

“Seam”. Configuration overview contains all general pointers to set-up Seam.. However in my opinion to try Seam the reader need more information or real samples. And wow! It’s the first write-up (even considering that short one) about Seam which is not talks about Conversations at all! :)

“Mixing JSTL and JSF”. It’s unfortunately not about mixing but about replacement h:dataTable to c:forEach. And I do not see advantages – why should I use it?

“Integration with Hibernate and Mixing Spring and JSF”. I think that such kind of content is just not for cookbook. Being the guy who need to learn something new from the real kick start samples - I still not see how to do at list something simple with that.

“JPA”. Finally I’m seeing some sample and it’s cool that I finally could check how to actually reach the db in my JSF action. It’s sad that login action not implemented but in general I understand how to proceed with that. So seems most useful recipe in that chapter.

Configuring JSF related technologies.

Some lack of versioning information. E.g. only RichFaces 3.3 and older versions requires Filter. But in general such section could be useful in order to quickly check the settings required for libraries usage.

Conclusion

Actually my conclusion was already written at the beginning. I believe that the book will find a place on your shelf and you will check it from time to time when needs to implement some concrete case quickly. All the problematic parts listed – just pointers for the author for future and I believe that he could successfully continue his works creating useful books for JSF community developers.

Get updates of that blog in twitter

RichFaces At JavaOne 2010

Posted by    |       |    Tagged as JSF Rich Faces Seam

Surprisingly enough this was my first JavaOne. I know there are a lot of alumni out there, but for me this was #1. I went into it with very few preconceived expectations. For the most part it lived up to my expectations, but I must say after seeing the IronMan display out front of the keynote I expected Larry Ellison to make an entrance like Tony Stark.

I heard from many people that previous JavaOnes were better. That's fine, but this was fun too. It was clear they wanted Oracle OpenWorld, and JavaOne separate, but I was even ok with that. The attendees, and speakers had lots of open conversations, and I thought that the technical content was really good. Sure we had to go between a few different hotels, but so what. The only really annoying part was the shifting of schedules, and rooms, and trying to keep track of it.

RichFaces

This year at JavaOne the RichFaces team had a very good, but busy time. We gave a couple of core presentations; A Peek At The Future: Going Beyond JavaServer Faces 2.0 With RichFaces 4 with Alex Smirnov and myself. Max Katz also gave one call Hands-on with RichFaces. Both were heavily attended, and went well.

Alex and I also gave 3 mini-presentations at the JBoss booth. One of our mini-booth talks was a condensed version of our JavaOne talk, but the other was all about RichFaces in the Cloud and introduced our new Google App Engine archetype for getting JSF 2 and RichFaces on GAE in about 5 minutes. See below for more

During our talks Alex introduced one of our new features, true Client Side Validation with RichFaces with Bean Validation. This really caught the attention of people. For a good reason, because what is a primary reason an application makes Ajax requests? Validation, right. Well soon enough with RichFace 4.0 we will have JavaScript implementations of validators, converters, and messages! This is all going to be tied into Bean Validation through JSF. Image how much better your applications can scale when you don't need to make a request just to check a value is not null.

As a side note, a particularly funny moment was when I promoted one of our RichFaces mini-booth presentations as Come hear about RichFaces, your NoSQL solution for JSF. I can't credit this to myself though, I was talked into it by Manik Surtani of Infinispan fame. We thought it would draw a new, albeit confused, new crowd. I even had my comeback ready for the questions -- I can guarantee, there is not single line of SQL in our runtime ;-)

Whats Next

The RichFaces team is in the middle of getting the 4.0.0.Milestone3 release out, and working on some other details. One thing we are getting ready to announce is the RichFaces showcase demo hosted and available on Google App Engine. We're not quite ready on that one, but keep an eye here for more.

If you are itching to get on Google App Engine, you can always start with our RichFaces GAE archetype that we talked about at our RichFaces in the Cloud talk at the JBoss mini-booth.

Thanks for everyone that attended and that we talked with!! It was a good time, and we hope to see you there next year :-)

RichFaces 4.0.0 Release Plan Updated

Posted by    |       |    Tagged as JSF Rich Faces Seam

The RichFaces team has finished a review of the remaining components and features planned for the 4.0.0 release. In order to deliver the quality, and functionality we aspire to we have decided to revamp our release schedule. We are in the process of updating our wiki, and jira to reflect these changes.

Roadmap to 4.0.0.Final

We have added two more milestone releases, bringing our total to five. Since these are roughly monthly releases this pushes the release out to just past the new year. Each milestone release will bring a new set of components, features, and stability.

  • October, 2010 : 4.0.0.Milestone3 In Development
  • November, 2010 : 4.0.0.Milestone4
  • December, 2010 : 4.0.0.Milestone5
  • January, 2011 : 4.0.0.CR1
  • January, 2011 : 4.0.0.CR2
  • February, 2011 : 4.0.0.Final

Why The Shift?

We had hoped to get the final release of 4.0 out before the end of the year, but as mentioned previously we have run into various hurdles:

These include identifying issues in the JSF 2 specification, and implementations (JSF RI, MyFaces). We have worked with both groups to discuss, and help resolve these issues. As a result we are integrating the latest releases of both.

We also need to make sure that the components and features we are creating in the release live up to our standards of both functionality, and stability. RichFaces 4.0 is more than just a component library and we aim to provide these features to you ready for your project - be it personal, or enterprise. This includes having the proper tooling with IDE's such as JBoss Tools, cloud deployment options, migration resources, and working towards component library interoperability.

When Can I Start Developing With 4.0

The short answer is right now! 4.0.0.Milestone2 has been released and contains everything needed to get going. At this point the build structure, and core functionality is stable. The list of components already available is long. As milestones are released they should be drop in replacements with added components, and features.

As the project is working hard to get releases out your, feedback is always welcome and will help the project get to where it is going even faster. If you find any issues or have an idea for the project please let us know! You can drop by our weekly meeting, post to the forums, create a jira, or even pick a jira or two ;-)

[RichFace 4.0 Release Center] [Project Site] [Downloads] [JIRA] [User Forums] [Design Forums] [RichFaces Twitter]

RichFaces 4.0.0.M2 Released!!

Posted by    |       |    Tagged as JSF Rich Faces Seam

The RichFaces team has just released 4.0.0.M2, and we are one more milestone closer to the Final. This is our second monthly milestone release, with new components, bug fixes, and other updates. We also worked hard to stabilize the core, CDK, build system, and previously migrated components.

You can download the distribution at our RichFaces download page. The RichFaces-4.0.0.M2 distribution has everything you need to get started. Check out the readme.txt files for any details, or dependencies. If you are a maven user you can follow the instructions here: How to add RichFaces 4.X to Maven Based Project. Note that with the build updates some of the maven information has changed.

Some notable updates:

For all the details you can review the 4.0.0.M2 Release Notes. and please let us know of any problems for bugs you may find.

Next Up Milestone 3

In Milestone 3 we are ramping up component development, including calendar, autoComplete behavior, tabPanel, messages, collapsiblePanel, inplaceSelect, and more. This release is scheduled for late September, early October.

If we are missing your favorite component, or if you find an issue please let us know either through our forums, or our project jira. You can also see our current plans by following the 4.0.0.Milestone3 project in jira, or dropping by one of our public IRC meetings. See our Project Calendar and the Meeting Information page for more details, agendas, and minutes.

So What About the Final Release

We are in the process of evaluating the remaining components, and features for the Final release. Although our schedule have slipped due to unforeseen issues, we still plan to get the Final release out as soon as possible. More to come…

[Project Site] [Downloads] [JIRA] [User Forums] [Design Forums] [RichFaces Twitter]

RichFaces 4.0.0.M1 Released!

Posted by    |       |    Tagged as JSF Rich Faces Seam

RichFaces 4.0.0.M1 has been released!! This is the first of our monthly releases on the road to the 4.0.0.Final release. From here on out every month we will release an updated milestone with new components, features, and stabilization!

As always you can download the release at the RichFaces Download page and the readme.txt in the RichFaces-4.0.0.M1 distribution contains all you need to get started and integrate the library into your application. If you are using maven for your project you can follow the wiki instructions: How to add RichFaces 4.X to Maven Based Project.

For all the details you can review the 4.0.0.M1 Release Notes. and please let us know of any problems for bugs you may find.

Some notable updates:

Draft CDK Development Guide

We're also really glad to announce a new 'CDK Guide' document started by Bernard Labno ( who's also working on a scheduler component for 4.0)! For now it is a google document and is not complete, but worth a look through. We are planning to shift this to a wiki based guide on the CDK in order to be closer to our community. Bernard has done a great job starting the document, and any feedback or contributions are welcome!

Milestone2 and Beyond

Our next release is going to be 4.0.0.M2 and is scheduled for release in late August. At that point CDK and core should be stable, and component migration should be in full swing. If we are missing your favorite component, or if you find an issue please let us know either through our forums, or our project jira. You can also see our current plans by following the 4.0.0.Milestone2 project in jira, or dropping by one of our public IRC meetings. See the Project Calendar and the Meeting Information page for more details, agendas, and minutes.

[Project Site] [Downloads] [JIRA] [User Forums] [Design Forums] [RichFaces Twitter]

RichFaces 4.0.0.Alpha2 Released!!

Posted by    |       |    Tagged as JSF Rich Faces Seam

RichFaces 4.0.0.Alpha2 has been released, and the project is moving into a new phase! We had a lot to do on our way to this milestone, not only did we add new features, and components, but also made many general improvements. The core functionality, build system, and CDK features were redesigned to make framework development more convenient for RichFaces developers and community contributors.

Some highlights in RichFaces 4.0.0.ALPHA2:

  • Redesigned and improved Component Development Kit
  • Ajax core components set almost completely migrated.
  • Ajax request smart Queuing mechanism implemented
  • Rich Data Iteration components created
  • Skinning including standard control skinning feature was migrated.

You can download all the release artifacts at the RichFaces download page, and review the release notes. The distribution readme.txt in the richfaces-4.0.0.ALPHA2 file contains all you need to get started and integrate the library into your application. If you are using maven you can follow the wiki instructions: How to add RichFaces 4.X to Maven Based Project.

Our next release will be 4.0.0.Milestone1 (M1), and is the first of the time-boxed milestone releases. For M1 we will be releasing right around July 20th, with future milestone releases about every month, until we are ready for the final 4.0.0 releases.

Get Started Quick with our Archetype

This release also includes a maven archetype. This will create an very basic application that you can build from, and update as needed. For future releases we'll have more complex archetypes as well.

To use the archetype the first step it to follow the JBoss Maven Settings to get the repository set up in your settings.xml file. Then generate the archetype:

mvn archetype:generate -DarchetypeGroupId=org.richfaces.archetypes -DarchetypeArtifactId=richfaces-archetype-simpleapp -DarchetypeVersion=4.0.0.Alpha2 -DgroupId=my.group.id -DartifactId=new_project

For all the details check out our Getting Started Guide.

Components

As I said we have added many components, including rich:dataTable, and rich:extendedDataTable. The complete list of the available components, behaviors, tags, and functions are listed below. Every monthly milestone release we'll be adding to this list, and stabilizing what is already here. Give these a shot and let us know what you think, or if you run into any issues.

Core:

  • a4j:ajax
  • a4j:commandLink
  • a4j:commandButton
  • a4j:push
  • a4j:mediaOutput
  • a4j:status
  • a4j:jsFunction
  • a4j:log
  • a4j:outputPanel
  • a4j:poll
  • a4j:param
  • a4j:queue
  • a4j:attachQueue
  • a4j:repeat
  • a4j:region

Iteration:

  • rich:dataTable
  • rich:extendedDataTable
  • rich:subTable
  • rich:dataScroller
  • rich:subTableToggleControl
  • rich:columnGroup
  • rich:column

Miscellaneous:

  • rich:clientId
  • rich:element
  • rich:component
  • rich:isUserInRole
  • rich:findComponent
  • rich:componentControl
  • rich:hashParam

RichFaces Showcase Alpha2

We've also updated our showcase example to highlight the new components, and some of the new options. The readme.txt file in the <richfaces-4.0.0.Alpha2.zip>/examples/richfaces-showcase directory explains how to build and run the example. Hint maven clean package then deploy to your container :-)

All of the source is there for you to import into your favorite IDE, and explore. If you are using JBoss Tools it is easier than ever with the included m2eclipse plugin.

Component Development Kit

The 4.0 Component Development Kit (CDK) is also nearly complete! We use this to help us make our components, and you can create your own with it as well. We've created an initial CDK distribution, and have some initial archetype to kick start your component project. Keep an eye out for more details on using the CDK in our wiki, and blogs.

What's To Come

As I said above the project is entering a new phase, and we will have regular monthly milestone releases of 4.0, leading up to the final 4.0 release. This will allow everyone to see the progress being made, integrate components into your applications, etc…. More importantly I hope that we will see feedback, bugs, and contributions from those who can try it out. You can checkout the 4.0.0.Milestone1 jira for the latest of planned items.

How To Get Involved

As I've said before RichFaces is an open community project, and we always welcome people to get involved anyway they can!

With the 4.0.0.Alpha2 release we have made significant updates to the RichFaces build structure, and design of our project: RichFaces 4.0 Build Structure. This is going to make development of RichFaces easier for new people and let users work on new components in various sandbox areas. We'll be posting new wiki pages, and blogs outlining that in more details soon!

We also continue to have our weekly meeting via IRC which anyone can attend and participate, please see the Project Calendar and the Meeting Information page for more details, agendas, and minutes.

[Project Site] [Downloads] [JIRA] [User Space] [Development Space] [RichFaces Twitter]

In this third part we'll be hooking up JPA 2 with the static metamodel generator, Bean Validation and Envers

JPA

Let's get persistent. When we're talking persistence, we need a persistence.xml so let's make a folder META-INF src/main/resources and create one there

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
	version="2.0">
	<persistence-unit name="Greetings">
		<jta-data-source>java:/DefaultDS</jta-data-source>
		<properties>
			<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect" />
			<property name="hibernate.hbm2ddl.auto" value="create-drop" />
			<property name="hibernate.show-sql" value="true" />
		</properties>
	</persistence-unit>
</persistence>

We're using the standard HSQL DefaultDS that comes with JBoss AS 6. If you want to be really hip, google around for @DataSourceDefinition which is a new kid on the block in EE 6 (haven't tried if AS 6 supports it yet, though)

Next, let's expand our model from Strings to a Greeting entity. Create a

package com.acme.greetings;

import static javax.persistence.TemporalType.TIMESTAMP;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Temporal;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

@Entity
public class Greeting
{
   @Id
   @GeneratedValue
   int id;

   String text;
   
   @Temporal(TIMESTAMP)
   Date created = new Date();

   public int getId()
   {
      return id;
   }

   public void setId(int id)
   {
      this.id = id;
   }

   public String getText()
   {
      return text;
   }

   public void setText(String text)
   {
      this.text = text;
   }
}

change the GreetingBean to

package com.acme.greetings;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.event.Event;
import javax.inject.Inject;
import javax.inject.Named;

import org.icefaces.application.PushRenderer;


@ApplicationScoped
@Named
public class GreetingBean implements Serializable
{
   Greeting greeting = new Greeting();
   List<Greeting> greetings = new ArrayList<Greeting>();

   @Inject
   @Added
   Event<Greeting> greetingAddedEvent;

   @Inject
   GreetingArchiver greetingArchiver;
   
   @PostConstruct
   public void init()
   {
      greetings = greetingArchiver.loadGreetings();
   }

   public void addGreeting()
   {
      greetings.add(greeting);
      greetingAddedEvent.fire(greeting);
      greeting = new Greeting();
      PushRenderer.render("greetings");
   }

   public Greeting getGreeting()
   {
      return greeting;
   }

   public void setGreeting(Greeting greeting)
   {
      this.greeting = greeting;
   }

   public List<Greeting> getGreetings()
   {
      PushRenderer.addCurrentSession("greetings");
      return greetings;
   }

   public void setGreetings(List<Greeting> greetings)
   {
      this.greetings = greetings;
   }
}

We have also injected an event that is fired when comments are added:

@Inject
@Added
Event<Greeting> greetingAddedEvent;

so we need a qualifier called Added:

package com.acme.greetings;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import javax.inject.Qualifier;

@Qualifier
@Retention(RUNTIME)
@Target( { METHOD, FIELD, PARAMETER, TYPE })
public @interface Added
{
}

and greetings.xhtml to

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ice="http://www.icesoft.com/icefaces/component"
	xmlns:ui="http://java.sun.com/jsf/facelets">
	<h:head>
		<title>
			Greetings
		</title>
	</h:head>

	<h:body>
		<h:form>
			<ice:inputText value="#{greetingBean.greeting.text}" effect="#{greetingBean.appear}"/>
			<h:commandButton value="Add" action="#{greetingBean.addGreeting}" />
			<h:dataTable value="#{greetingBean.greetings}" var="greeting">
				<h:column>
					<h:outputText value="#{greeting.text}"/>
				</h:column>
			</h:dataTable>
		</h:form>
	</h:body>
</html>

(we changed the order of the table and the input fields as it was getting annoying to have the field and button move down as we add comments)

Of course since we are firing events it would be nice if someone is actually listening. Let's create a GreetingArchvier:

package com.acme.greetings;

import java.util.List;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.event.Observes;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

@ApplicationScoped
public class GreetingArchiver
{
   @PersistenceContext
   EntityManager db;

   @Inject
   UserTransaction userTransaction;

   public void saveGreeting(@Observes @Added Greeting greeting)
   {
      try
      {
         userTransaction.begin();
         db.joinTransaction();
         db.persist(greeting);
         db.flush();
         userTransaction.commit();
      }
      catch (Exception e)
      {
         e.printStackTrace();
         // The recommended way of dealing with exceptions, right?
      }
   }

   public List<Greeting> loadGreetings()
   {
      return db.createQuery("from Greeting").getResultList();
   }

}

That observes @Added Greetings and store them to the database. Notice also the loadGreetings() method that GreetingBean calls in it's @PostConstruct to populate itself with old comments. Well, with create-drop in our persistence.xml there won't be much to load but let's fix that later.

JPA 2

That's all nice but we're trying to be livin' on the edge so let's bring in JPA and typesafe queries and with those we better have some static metamodel generator, otherwise the attributes will quickly become a burden. There is Eclipse integration available (google around) but if you're doing automated maven-based builds, you're going to need this anyway. Since both Eclipse and Maven are involved in building, be prepared for some chicken-egg-project-cleaning-and-refreshing in Eclipse from time to time when adding new entities. Anyways, open up pom.xml and add some plugin repositories:

<pluginRepositories>
	<pluginRepository>
		<id>jfrog</id>
		<url>http://repo.jfrog.org/artifactory/plugins-releases/</url>
	</pluginRepository>
	<pluginRepository>
		<id>maven plugins</id>
		<url>http://maven-annotation-plugin.googlecode.com/svn/trunk/mavenrepo/</url>
	</pluginRepository>
</pluginRepositories>

The maven-compiler-plugin will need an argument to not process annotations automagically once we slap jpamodelgen on the classpath

<configuration>
	<source>1.6</source>
	<target>1.6</target>
	<compilerArgument>-proc:none</compilerArgument>
</configuration>

and the job should be taken over by our new build-plugins:

<plugin>
	<groupId>org.bsc.maven</groupId>
	<artifactId>maven-processor-plugin</artifactId>
	<version>1.3.5</version>
	<executions>
		<execution>
			<id>process</id>
			<goals>
				<goal>process</goal>
			</goals>
			<phase>generate-sources</phase>
			<configuration>
				<outputDirectory>target/metamodel</outputDirectory>
			</configuration>
		</execution>
	</executions>
	<dependencies>
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-jpamodelgen</artifactId>
			<version>1.0.0.Final</version>
		</dependency>
	</dependencies>
</plugin>
<plugin>
	<groupId>org.codehaus.mojo</groupId>
	<artifactId>build-helper-maven-plugin</artifactId>
	<version>1.3</version>
	<executions>
		<execution>
			<id>add-source</id>
			<phase>generate-sources</phase>
			<goals>
				<goal>add-source</goal>
			</goals>
			<configuration>
				<sources>
					<source>target/metamodel</source>
				</sources>
			</configuration>
		</execution>
	</executions>
</plugin>

Dan Allen thinks this is a lot of configuration for this task, I'll have to remember to ask if he ever got his simple, elegant solution to place the artifacts in usable places ;-)

Run mvn eclipse:eclipse to have the target/metamodel added to eclipse and do the project level Maven, refresh project configuration.

Run the maven build and you should see the Greeting_ class appear in target/metamodel and in the WAR structure. Now let's bring it into use:

First we add EntityManger/EntityManagerFactory producers (the recommeded CDI way of wrapping them)

package com.acme.greetings;

import javax.enterprise.inject.Produces;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.PersistenceContext;
import javax.persistence.PersistenceUnit;

public class DBFactory
{
   @Produces @GreetingDB @PersistenceContext EntityManager entityManager;
   @Produces @GreetingDB @PersistenceUnit EntityManagerFactory entityManagerFactory;
}

We also need a qualifier for that

package com.acme.greetings;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import javax.inject.Qualifier;

@Qualifier
@Retention(RUNTIME)
@Target( { METHOD, FIELD, PARAMETER, TYPE })
public @interface GreetingDB
{
}

Finally, let's modify or GreetingArchiver:

package com.acme.greetings;

import java.util.Date;
import java.util.List;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.event.Observes;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.ParameterExpression;
import javax.persistence.criteria.Root;
import javax.transaction.UserTransaction;

@ApplicationScoped
public class GreetingArchiver
{
   @Inject
   @GreetingDB
   EntityManager db;

   @Inject
   UserTransaction userTransaction;

   CriteriaQuery<Greeting> loadQuery;
   ParameterExpression<Date> timestampParam;

   @Inject
   public void initQuery(@GreetingDB EntityManagerFactory emf)
   {
      CriteriaBuilder cb = emf.getCriteriaBuilder();
      timestampParam = cb.parameter(Date.class);
      loadQuery = cb.createQuery(Greeting.class);
      Root<Greeting> greeting = loadQuery.from(Greeting.class);
      loadQuery.select(greeting);
      loadQuery.where(cb.greaterThan(greeting.get(Greeting_.created), timestampParam));
   }

   public void saveGreeting(@Observes @Added Greeting greeting)
   {
      try
      {
         userTransaction.begin();
         db.joinTransaction();
         db.persist(greeting);
         db.flush();
         userTransaction.commit();
      }
      catch (Exception e)
      {
         e.printStackTrace();
         // The recommended way of dealing with exceptions, right?
      }
   }

   public List<Greeting> loadGreetings()
   {
      Date tenMinutesAgo = new Date();
      tenMinutesAgo.setTime(tenMinutesAgo.getTime() - 10 * 60 * 1000);
      return db.createQuery(loadQuery).setParameter(timestampParam, tenMinutesAgo).getResultList();
   }
}

Bean Validation

Adding Bean Validation is a breeze, just stick the annotations on the entity fields in Greeting:

@Size(min = 1, max = 50)
String text;

and attach a message to the input field in greetings.xhtml:

<ice:inputText id="feedback" value="#{greetingBean.greeting.text}" effect="#{greetingBean.appear}"/>
<h:message for="feedback" />

I tried placing a @NotNull on text but it still failed on submit because the values came in as empty string (might be this is the designed behavior) so I used min = 1 instead.

Envers

If you would like to have auditing on your entities, you need to add the Envers dep to pom.xml

<dependency>
	<groupId>org.hibernate</groupId>
	<artifactId>hibernate-envers</artifactId>
	<version>3.5.1-Final</version>
	<scope>provided</scope>
</dependency>

I cheated a little and marked it provided as it was pulling in a lot of deps. I downloaded the envers.jar and dropped it in the server common lib with it's other hibernate buddy-jar:s. After that we can stick an annotation on the entity

@Entity
@Audited
public class Greeting

Last but not least to enjoy automatic data auditing we need to add the Envers listeners to persistence.xml

<property name="hibernate.ejb.event.post-insert"
	value="org.hibernate.ejb.event.EJB3PostInsertEventListener,org.hibernate.envers.event.AuditEventListener" />
<property name="hibernate.ejb.event.post-update"
	value="org.hibernate.ejb.event.EJB3PostUpdateEventListener,org.hibernate.envers.event.AuditEventListener" />
<property name="hibernate.ejb.event.post-delete"
	value="org.hibernate.ejb.event.EJB3PostDeleteEventListener,org.hibernate.envers.event.AuditEventListener" />
<property name="hibernate.ejb.event.pre-collection-update"
	value="org.hibernate.envers.event.AuditEventListener" />
<property name="hibernate.ejb.event.pre-collection-remove"
	value="org.hibernate.envers.event.AuditEventListener" />
<property name="hibernate.ejb.event.post-collection-recreate"
	value="org.hibernate.envers.event.AuditEventListener" />		

This concludes part II, next time we'll be looking at EJB:s and MDB:s in more details. And perhaps abandoning our WAR-only utopia for now. Guess I'll have to learn about the maven EJB plugin. Hints for good tutorials accepted.

PS. Have you checked the size of the WAR file after you've taken all these technologies into use? Around 320k. And of those ~85% are the ICEfaces libs (the only external deps)

back to top