Thursday Dec 10, 2009
Thursday Feb 15, 2007
By paulsen on Feb 15, 2007
Woodstock JavaServer Faces Components
Sun has delivered some great components as part of Sun Java Studio Creator and NetBeans Visual Web Pack. But if you don't use one of those products, you probably didn't know it. Well, now you don't have to use these tools to enjoy the rich JavaServer Faces components they provide. In fact not only are they available outside these products, they are now Open Source!
Project Woodstock is the Java.net project which contains the source code for these components. Both Creator's and NB VWP components were derived from earlier versions of this code base. The code is released under the very flexible CDDL license. These components have been in the making for over 2 years and have gone through several development cycles. They're stable, full featured, and work seemlessly together sharing a common theme -- they're ready for production!
Let's take a look at what some of these components look like:
All of these components are "themed" so you can adapt the look of these components to your company's look and feel by creating your own theme. Many of the components use Ajax (via Ed Burn's Dynamic Faces project), and more Ajax features are sure to come. The TLD document and example application included in the project provide more than enough information to get you started.
If you're a Faclets user, Jason Lee is already working on creating a Facelets taglib for Woodstock. And of course if you're a JSFTemplating user, I have full support for the Woodstock components built in... plus I have a simple example app on the site to get you started. Plus, the entire GlassFish admin console (source here) is built using JSFTemplating and Woodstock components. So whatever your JSF environment (NetBeans, Facelets, JSFTemplating), you'll be able to use these components.
So what are you waiting for? Go download the components and try them out!
Tuesday Jan 09, 2007
By paulsen on Jan 09, 2007
Ok, let's get right to it. Ajax is hot, but it needs to be "real". You need a fast way to be productive with Ajax, not gfx-clock productive, but real-world productive. Let me offer a suggestion...
In an effort to keep my blog entries concise (part of my New Year's Resolution), I will get right to the point. By using JSFTemplating with Ed Burns's DynamicFaces project, you have a perfect Ajax solution tailored to JSF's component architecture. Add JSF widgets like those found Greg Murray's jMaki project and you have a complete solution. However, I will save jMaki for a later blog. I want to stick to the basics for this entry -- Keep It Simple.
I created a very simple example which shows all you need and little more. You can download the complete war file and try it out. Here are the contents of the .war file:
guess.jsf <-- JSF pageWEB-INF/lib/dataprovider.jar <-- Sun component libraries & dependenciesWEB-INF/lib/json2.jarWEB-INF/lib/webui-jsf.jarWEB-INF/lib/webui-jsf-suntheme.jarWEB-INF/lib/jsftemplating.jar <-- JSFTemplating .jar fileWEB-INF/lib/jsftemplating-dynafaces-0.1.jar <-- JSFTemplating/DynamicFaces integration .jar fileWEB-INF/web.xml <-- deployment descriptor
This is a 1 page application -- doesn't get much simpler than that. It also doesn't use any managed beans, or any custom Java code. Instead it leverages JSFTemplating to do everything in the .jsf file. Let's look at the page:
And the source:
The blue area above defines an area where a prompt will be shown to the user. The beforeCreate event allows an initial value to be set. PageSession is a JSFTemplating-added scope. The value bound to the pageSession variable msg will be shown to the user. This is plain, oridinary text that will be replaced by an Ajax request.
- immediate: Not really needed, but if there was validation on the field in "execute" immediate would skip the validation. In this example it does nothing useful. I added it to show that the other required field on the page truely isn't processed even when immediate is false. This is true partial-page processing.
- inputs: The values sent to the server. This may be different than the components processed. In this case the HTML id of the form field is different than the component id because of how the componet is implemented, so I need to send "form:guess_field" for the value to be sent correctly during the Ajax request.
- render: This specifies which area(s) of the screen should be updated with the response. In this case the <div> around our message text.
Finally, the green area is the business logic. It evaluates the submitted value and displays an appropriate response. In real-world JSFTemplating applications, you'd likely put this in Java code in a handler such as is done by the built-in "setPageSessionAttribute" handler in this example. But to keep the example simple (1 page), JSFTemplating's condition processing was used instead.
- The Ajax Experiment
- JavaOne Hidden Treasure
- Looking for Opinions...
- Introducing GlassFish Performance Tuner
- Tips for creating a GlassFish Admin Console Plugin
- GlassFish Birds Of a Feather (BOF) Session at JavaOne 2008
- Don't forget your laptop!
- Where will you be at JavaOne?
- JavaServer Faces overview @ the Salem JUG
- GlassFish Book Review