2015
October
-
Kotlin Faces
There’s a chance that at least some of you saw the blog title and thought: "Ah ha! A Kotlin wrapper/helper for JSF!" and rushed over to check it out. If so, mission accomplished. :) This really isn’t anything that ambitious. Sorry. :)
At JavaOne this week, I spent a good deal of time talk to Hadi Hariri, Developer Advocacy Team Lead at JetBrains, about their Kotlin language. With my long background in Java webapps, I often reach for my webapp hammer when trying to learn a new language, so I asked Hadi what Kotlin library he would suggest. His answer, in a nutshell, was that the Java interop in Kotlin is so good, just use whatever you want, so I thought I’d put that to the test with a really simple JSF app. Here it is.
2013
August
-
WebJars and JSF
WebJars, for those that haven’t heard, is a project that takes popular client-side web libraries and packages them in JARs to make their use in Java-/JVM-based web apps simpler. The web site notes that you can easily see which libraries a project is using simply by looking at its dependencies, and that transitive dependencies automatically appear. It’s a pretty compelling project, but, for some reason, it doesn’t show how to integrate it with JSF. I’d like to think it’s because it’s so trivial, but I’ll show it here anyway. :)
2012
July
-
Writing Pluggable Java EE Applications, The Explanation
I recently posted the slides and the source code from the presentation I gave at JAXConf San Francisco. While that’s helpful for those who were in my session, it’s probably less so for those who weren’t. What I’ll do in this post, then, is discuss the slides and code in detail, skipping over the introductory slides, and getting right to the heart of the matter.
2011
January
-
Running Long-Running Reports with JMS
At a recent meeting of the Oklahoma City JUG, I was asked by a member how her group could "script" JSF report generation. After a couple of questions, I figured what she really wanted: she wanted a way to allow users to request reports in an ad hoc manner, as opposed to the reports being run on a schedule. In a general sense, this is a pretty easy question to answer, but I’ve run into situations where the reports take a long time to run — and I’m sure she will, as well — making a web interface for generating the report less useful (due to timeouts, etc). In this entry, we’ll take a look at one way to handle that.
2010
September
-
Interested in Remote Method Calls via JS in JSF?
One of the nicest enhancements to the JSF specification that 2.0 brought was the inclusion of native Ajax support. It is now extremely simple to Ajaxify a JSF application. One thing that it lacks, though, is the ability to call arbitrary methods on JSF (or CDI?) Managed Beans. There is a project that offers that kind of functionality, and it’s been around for years: Direct Web Remoting. I’ve used this library at times and have found it to be really useful in certain situations. That got me to wondering, Should this kind of functionality be a first class citizen of JSF? To help us decide, let’s take a quick look at how DWR works.
August
-
Mojarra 1.2_15 Now In Maven Repo
Way back in July, Ed Burns released and announced Mojarra 1.2_15, which is mostly a backport of performance fixes from the 2.0 branch. Given recent changes on the Mojarra team1, there was some confusion and difficulty getting the jars published to the java.net Maven repository. I’m happy to report, though, that we’ve gotten those kinks worked out, and that this new release of the 1.2 branch of Mojarra is now available for your Mavenized pleasure. Note that this is the Maven 1 repository, and it’s not in central. Those are separate issues on which we’re still working.
1 Many, many thanks to you, Ryan, for all of your hard work over the years, and best of luck in your new position. :)
-
Book Review: JSF 2.0 Cookbook
image::https://www.packtpub.com/sites/default/files/imagecache/productview/9522.jpg
Packt Publishing recently released a book titled JSF 2.0 Cookbook, by Anghel Leonard. When I first heard about this book, I was really anxious to get my hands on it. I really like the cookbook concept, so I was excited to see a work in that vein published for JSF. Packt recently sent me a copy to review, so, having read most of the book, here are my thoughts.
First off, I’ll be upfront: I have not read the whole book, but I don’t think that’s a problem. Cookbooks aren’t meant to be read cover to cover, necessarily. While you can certainly do that, these types of books are intended to be a reference. When you have an issue, you look in the table of contents to find the "recipe" that covers your issue, and jump to that page. That’s what I did with this book, mostly. I looked up the recipes for issues I most often have trouble with. I did, though, read almost all of the custom component chapter, as that’s area that holds a lot of interest for me. I’ll give that one special attention in a moment.
Each recipe, follows the same basic pattern. It starts with a basic summary of the problem, then goes in to "Getting ready," "How to do it…," "How it works…" and "See also." There are minor deviations along the way, but that’s the basic gist. In the Getting Ready section, the author details how the recipe was created (NetBeans 6.8, Mojarra 2.x, and GlassFish v3, showing the author has great tastes : ), so new users can get a sense of what might help work through the recipe. The How to do it section is pretty detailed, with LOTS of source code. Much of the markup is still using JSP, which is a shame since JSP is all but formally deprecated with JSF 2.0 (Facelets being the de facto standard), but you shouldn’t have any major issues applying what you see to a Facelets page. The How it works section that follows does a great job of explaining…err… how it works, which I think is really important. How to do something is rarely enough. If you understand why to do something and how that something works, you’ll be better equipped in the future for similar, but slightly different issues. This section does a good job of that.
The only area of the book I want to comment on specifically is Chapter 5, Custom Components. Of all the areas in JSF, component authoring has always been a favorite of mine. I am far from being a leading expert, but I’m pretty comfortable with it and really enjoy it. Chapter 5, then, was one of the first things I turned to. The author does a great job of giving a variety of examples using validators, ajax, etc. A big glaring flaw for me, though, was the discussion of the JSF lifecycle, a very important topic for component authors. In the graphic on page 130, encoding is shown as happening in the Apply Request Values Phase, and decoding is shown as happening in the Render Response Phase. Unless I’m sorely mistaken, that’s exactly backwards. Despite that error, the chapter itself is extremely helpful. I would advise, though, that if you are looking to learn component development, to try JavaServer Faces 2.0: The Complete Reference by Ed Burns, and Chris Schalk, or Core JSF by David Geary and Cay Horstmann. That’s not to belittle this book in anyway. The Geary/Hortsmann and Burns/Schalk books are meant for different purposes. JSF 2.0 Cookbook has a slightly different purpose, which is complementary to the first two, and which it does well, I think.
Overall, I think this is a really good book. Though not perfect, it provides a lot of value to the JSF developer. From beginner to expert, I think there is enough in this book to help just about everyone out of a jam from time to time.
June
-
Book Review: JSF 1.2 Components
Some time ago, I was given a copy of JSF 1.2 Components by Ian Hlavats and asked if I’d write a review for it. It’s long overdue, but here are my thoughts on this book.
February
-
New Components in Mojarra Scales: Part IV – sc:combo
Yesterday brought us Part III in our look at some new components in Mojarra Scales. Today, Part IV brings us
sc:combo
, combination, if you can imagine that, of ah:selectOneMenu
andh:inputText
. -
New Components in Mojarra Scales: Part III – sc:imageZoomer and sc:lightbox
In Part II of this series, I introduced the new auto complete component in Mojarra Scales. In this installment, we’ll take a look at two new closely related components,
sc:imageZoomer
andsc:lightbox
.
2009
December
-
New Components in Mojarra Scales: Part II – sc:autoComplete
In Part I, I introduced the new YUI-backed Scales dataTable component. In this installment in the series, we"ll take a look at another new component available in Scales 2.0,
sc:autoComplete
. -
GlassFish v3 Virtual Conference
This is a little late notice, but we at Sun are holding a "virtual conference" covering GlassFish v3, Java EE 6, etc. You can find details here. It starts in 30 minutes (10:00 CST, 8:00 PST). :)
-
New Components in Mojarra Scales: Part I - sc:dataTable
The migration of Mojarra Scales to JSF 2, adding new components has become much easier due to JSF 2’s new composite component feature. In the past couple of weeks, this new capability has paid off in spades as Mojarra Scales has gotten (so far) three new components in rapid succession. In this, the first part of a multi-part series, we’ll take a look at the most complex of the new components,
sc:dataTable
.
November
-
The Mojarra Scales Demo Has Moved
With the recent migration of Mojarra Scales to JSF 2, the old location of the Mojarra Scales demo was no longer adequate (upgrading that server posed some issues). For that reason, I have moved the demo to a new home. This server should be more up-to-date (both in terms of the application as well as the application server — which is GlassFish v3, of course — that runs it). When accessing the application, please keep in mind that it’s on an old server that’s running on an AT&T U-verse line, and the download times will reflect that. :)
I’d also like to not that this showcases a couple of new components at the moment. I’ve begun an implementation of the YUI data table widget. At the time of this posting, basic table functions work, including client-side sorting. More complex functionality, such as Ajax updates, are in the offing.
Another new component, which the demo uses extensively, is the excellent SyntaxHighligher script from Alex Gorbatchev. The demo uses this new component to show the page source for each demo, finally allowing you to see a given component in action, as well seeing the page markup that makes those components. The demo is still in flux, so some things aren’t quite "perfect" yet. For example, Safari really hates the markup the demo produces, which is a bug in the demo application itself. Hopefully, that will soon be fixed. For now, Safari users will need to use another browser.
As I’ve noted, Scales has been migrated to JSF 2. While most components are working as expected, there are likely some minor issues to work out. If you run into any of these issues, or if you’d like to see extra functionality in any of the components, please feel free to file an issue on the Scales issue tracker on the Kenai project site.
October
-
JSF 2, h:dataTable, and Ajax Updates
While JSF has had Ajax support for a long time now, it has always been through external libraries such as Ajax4Jsf/RichFaces, ICEfaces, DWR, DynaFaces, etc. With JSF 2, the framework now has first class, standardized support for Ajax. This is good news on several fronts. For those that want Ajax support but would rather not import another library, that capability is now baked in, and, for those familiar with a4j or DynaFaces, it should look very familiar. However, for those that don’t mind the external dependency, the standardized Ajax will make it much easier to mix and match component libraries on the same page, an issue that has plagued JSF for while. In this post, I’d like to take the first approach and show how easy it is to achieve Ajaxy updates on your
h:dataTable
using only standard JSF. -
Mojarra 2.0 hits FCS
Ryan Lubke announced today the availability of the first production-ready JSF 2 implementation with the release of Mojarra 2.0. You can download the binaries directly from java.net, or, use the information Ryan posted for specifying a dependency in your Maven pom file.
August
-
Mojarra Scales 1.3.2 Has Been Released
Late last night, I published Mojarra Scales 1.3.2. This is mostly a bug and performance fix, but here are some highlights from the release:
-
<sc:links /> (and related supporting classes and components) was modified to allow files only from /scales to fix a pretty glaring security hole in some scenarios
-
When multiple, local requests for a given resource type (CSS or JS) are queued, they are now rendered to the page in such a way that they will be returned in a single request. That is to say, Mojarra Scales will now concatenate these files into one response, so as to reduce the number of network operations.
-
Scales now correctly handles cached files. When a CSS or JS resource is sent, Scales now employs etags to help the client cache the file properly. On subsequent requests, if the client sends the last modified header, Scales properly handles the date, returning 304 when appropriate
-
<tab/> now supports the
style
andstyleClass
attributes. -
The multi-file upload component has been moved out of the main jar into its own artifact so that those not using the component will have a smaller deployment. This component can be found under the upload
artifactId
in the maven repository.
The jar files, including the demo app, can be downloaded from kenai.com or via maven (the demo is not in maven).
With the architectural changes in 1.3 out of the way, the next version of Scales should include more components, as well as enhancements to existing components. At some point, the project will be branched for a migration to JSF 2. With the spec being final and Mojarra 2 scheduled to ship in a couple of weeks, it seems the time is right for the move. Time will tell, of course, how soon that move is made.
If you have any issues, please comment in the forum.
-
July
-
FacesTester 0.3 Has Been Released
After a lot of changes and a long delay, I’m pleased to announce that we have released FacesTester 0.3 tonight. This version has a large number of new features. Read on the for details.
May
- JavaServer Faces 2.0 Is Final!
-
FacesTester 0.2 Has Been Released
Today we released FacesTester 0.2. While this release has a number of bug fixes and more minor enhancements, one of the biggest new features is injection support. Leveraging the
InjectionProvider
Service Provider Interface (SPI) provided by Mojarra, FacesTester now supports the automagic injection of mock/test objects. For example, the following managed bean: -
Making Tables Harder Than They Need To Be
I know you’re not supposed to do this, but sometimes it’s just easier. Sometimes I use `table`s to layout out my forms. Especially for big forms, it’s just easier to put things in a table than deal with `label`s, CSS, etc. Right or wrong, I do it from time to time, but, thanks to David Geary, I just learned that I make it harder on myself than it needs to be. The sad thing is that I’ve known about this solution for years now, but never put two and two together.
-
UPDATED: Web Beans Webinar
On May 19th, Pete Muir, JSF 2.0 Expert Group member and Web Beans implementation lead (if I recall correctly) will be leading, in conjunction with The Aquarium, a webinar covering the forthcoming Java Contexts and Dependency Injection JSR (JSR-299, formerly known by the JSR’s former name, Web Beans). Unfortunately, that’s right in the middle of the Oklahoma City JUG’s meeting, so I can’t make it, especially since I’m this month’s speaker. For those of you that won’t be attending the OKC JUG tomorrow, this should be a good session on a great spec. I hope to catch the recording. Not as good as attending live, but it’s all I’ll be able to manage.
Dan Allen was nice enough to point out that I misread the announcement, which means OKC people can hear me talk AND attend this webinar. Win win! (win! ; )
April
-
Mojarra Scales 1.3.1 Has Been Released
Early this morning, I published Mojarra Scales 1.3.1. I’ve been remiss in making good updates where when I make release, so, rather than creating a new post for each release long after the fact, I’ll try to being everyone up to the current state in just one.
-
Book Review: Practical RichFaces
One of the great strengths and successes, I think, of the JavaServer Faces specification is the proliferation of third party components. One of the older and better known component sets is RichFaces, which started out under a company called Exadel and is now part of JBoss. For many, RichFaces is the first add-on component set for a new JSF project, and with good reason. I recently had the opportunity to serve as a technical reviewer on Max Katz’s Practical RichFaces from Apress. Read on for my review of the book.
-
FacesTester Can Now Test State Saving
In my experience, a pretty common bug with custom components is improper state saving. Since JSF components are, currently, stateful, it’s important that custom components integrate with the frameworks state saving mechanism correctly. Unfortunately, it can be an error-prone process, as it’s a manual effort. Now, however, custom component authors can use FacesTester to exercise this aspect of their components to help insure proper state handling. This article will show how to use this new feature of FacesTester.
-
My JSFCentral Interview Has Been Published
Careful readers of my blog (thank you, dear wife! : ) will remember that I was interviewed at JSFOne by the conference co-founder and JSFCentral founder Kito Mann. That interview, complete with transcript, has been published on JSFCentral. I was a bit nervous about how it would turn out, but I think it turned out pretty well. I’m not a big fan of hearing my recorded voice, but there’s not much to be done about that. :)
-
FacesTester 0.1 Released
About a month ago, I announced a new project, FacesTester, a JUnit-based testing tool for JSF that my good friend Rod Coffin and I have undertaken. Since then, Rod posted a very nice introduction to FacesTester usage. Today, we made our first official release, FacesTester 0.1. The version number should indicate that it’s still a work in progress, but it is already quite functional (I, for one, have been using it to build a test suite for Mojarra Scales, which has helped drive out features and resolve bugs very quickly). We wanted to push out a release to encourage people to download it, use it, and give us feedback.
So what does FacesTester currently support? Quite a bit. In this entry, we’ll take a quick look at what FacesTester offers, and what we have planned.
March
-
Webinar: From Ajax Push to JSF 2.0: ICEfaces on GlassFish
The GlassFish webinar series is, I think, a pretty valuable resource for regular readers of my blog, as it covers a lot of topics that I cover here. Today’s webinar, "From Ajax Push to JSF 2.0: ICEfaces on GlassFish," is particularly relevant, as it’s a JSF-related session. Here’s the abstract:
Ted will provide details on how to build and deploy rich web applications with Ajax and Ajax Push (aka Comet) and catch a glimpse of the future with an overview of JavaServer Faces 2.0.
This presentation illustrates the fundamentals of Ajax Push, covering application design, development, and deployment, drawing on ICEfaces sample applications and implementation. Topics will include network protocols, application-level push APIs, GlassFish Grizzly integration, and the ramifications of the two-connection limit.
Looking forward to JSF 2.0, we will cover Ajax integration, new scopes and annotations, and custom components.
I had the opportunity to see Ted present Ajax Push (their term for Reverse Ajax or Comet, if you prefer those monikers) at last year’s JSFOne conference. The ICEfaces demos are very, very slick, and the level of simplicity they managed to achieve is absolutely amazing. If you have any interest in Ajax Push/Reverse Ajax/Comet, you should certainly attend this session. If you are currently using JSF, this is a really good example of the power of component-based frameworks like JSF.
-
Announcing FacesTester
One of the issues that has always troubled me with regard to writing JSF applications (or any web application, really) is how hard it is to test them. Some time ago, while discussing various Java web frameworks, I stumbled across a class called
WicketTester
, which is part of the Wicket project. Using this class, as best as I can tell, Wicket authors can easily test their applications very quickly. Having taken the advice of Dale Hanchey, and old college professor of mine, "Never be too proud to steal a good idea," FacesTester was born.
February
-
What's Happening In the World of Mojarra Scales?
I’ve been a bit silent of late on what’s happening with Mojarra Scales, so I thought I’d take a moment to bring everyone up to speed.
January
-
Mojarra Scales Gets a Z-Order Update
As I noted in a recent entry, we are considering moving to a desktop-like interface for the GlassFish Administration Console, where the content is in separate "windows" (decorated DIVs, basically) which can be moved, closed, minimized, etc. As I’ve started working on a concrete implementation of some of those ideas, I quickly realized that we were going to have issues with multiple, overlapping windows. Once you have multiple windows open, the user has to be able to bring the desired window to the front, but YUI, which will likely be the library used, doesn’t support that natively. Fortunately, that’s easy to fix. First, an example of the problem:
-
Bootstrapping a JSF 2 project
I needed a break this afternoon, so I thought I’d see how easy it is to bootstrap a JSF 2 project. One of the biggest complaints about JSF 1.x is all that XML, so JSF 2 is aiming to fix that. How have we done so far? Based on this quick look (which is my first from-scratch JSF 2 app), really, really well.
2008
December
-
JSF 2 Gets Declarative Event Handling
If you’ve been following the evolution of the JSF 2 spec closely, you have probably seen the addition of a finer-grained event system (if you haven’t seen it, section 3.4 of the spec is the relevant one). These events include things like AfterAddToViewEvent, BeforeRenderEvent, ViewMapCreatedEvent, etc. An application developer could subscribe to these events from a managed bean by using the API exposed by the new system. While that is a big improvement over the way things work in 1.2, it still leave page authors out in the cold until, that is, this week. Yesterday I committed the code to support declarative even handling to Mojarra. In this short entry, we’ll take a look at what that entails, and how to use it.
-
A One-Man JSF 2 Blog Storm
As the specification writing part of JSF 2 comes to a close, we’re getting a more complete implementation done on the reference implementation, Mojarra. One of the primary developers on Mojarra is Jim Driscoll (the other being Ryan Lubke, who has done such an excellent job on the 1.2 series). Jim, apparently, has been in a writing mood and has posted a number of very good (and small) posts on some of the features coming in JSF 2 (similar to Ryan’s series from earlier this year).
I was about to start planning a smallish app, to be based on JSF 2, so I was perusing Jim’s entries, and it occurred to me that a list of the links would be helpful for those following JSF 2 but not Jim’s feed, so here it is. I hope it helps. :)
I know Jim has more planned, so subscribe to his feed. It should be well worth your time.
-
JSF 2.0 Public Review is online
The current state of the JSF 2 spec has entered the Public Review phase. If you have any interest in JSF, now is a good time to review what we’ve done in the spec thus far and send feedback, which we will discuss and digest for the Proposed Final Draft due out next. You can find the Public Review here, and you can send your comments here.
November
-
Seam, WebBeans and GlassFish
For some time now, Sun has made use of Ustream.TV to broadcast webinars covering various topics of interest to GlassFish users. That effort continues on November 20th at 11am PST as Eduardo Pelegri-Llopart hosts Dan Allen, author of Seam in Action to discuss Seam, WebBeans, and GlassFish. Some of WebBeans' companion specs (EJB 3.1 and JSF 2) will also be covered by spec leads Ken Saks and Roger Kitain, respectively. For more information, see this page on Sun’s wiki. To catch previous broadcasts on The Aquarium’s Ustream.TV channel, you can go directly there.
September
-
The Means Stultify the End
From time to time, someone, trying to cut through all the hype and spin, will attempt some sort of statistical analysis to determine which web framework is "winning." The results are almost always disappointing, and not because I don’t agree with the outcome, but because the methodology is so flawed. The most recent attempt I’ve discovered, noble as it is, is no different.
June
-
Mojarra Scales 1.0 RC2 is out
I have just uploaded RC2 for Mojarra Scales 1.0, a JSF component set born of the Mojarra Sandbox. This release features a number of bug fixes and a handful of new enhancements. When updating, make sure you grab the latest JSFTemplating snapshot from either its download page or Maven, as there are some bug fixes and features there that Scales needs. You can download the last jar here.
-
Where will you be the first weekend in September?
For those of you that like to hear me speak (and, yes, I’m looking at you, Mom!) I will be at JSFOne, a conference brought to you by the No Fluff Just Stuff team and dedicated to the JSF ecosystem.
-
JSF 2.0 Early Access Review Available
The JSF 2.0 Expert Group (operating under the auspices of JSR 314) has released Early Draft Review 1 of the upcoming revision of the spec. We are soliciting feedback, of course, and the window of opportunity for that runs through July 2. If you want to have some input on the direction of the specification, now is the time to speak up. :)
The major changes in this draft release are baked in Ajax support, and what we’ve termed "EZComp," which is better described as composite components. Composite components, which touches on a change to finalized in a later release, namely, the inclusion of Facelets, allows a component developer to create a new component by piecing together several others in a template file. This functionality is very similar, as best as I can tell as I’ve never used them, to Facelets' component support, where a snippet of markup is specified in a file and can then be treated as an actual component. Unlike the Facelets version, though, these composite components are "real" components in that they are backed by a UIComponent. If you were at JavaOne, this is what Ed demoed in this presentation (with Roger demonstrating the Ajax support).
There’s still much work to be done before September when we are schedule to deliver the Proposed Final Draft, but this is a pretty good start. If you have any interest at all, please review the spec and give us feedback. We really do want your input, as our goal is to improve upon the JSF experience and solve as many of the real world pain points as we can. If your favorite pain point isn’t being addressed, you owe it to yourself to speak up! :)
May
-
Mojarra Scales 1.0 Release Candidate 1
Today, I released the first release candidate for Mojarra Scales, the JSF component library I helped create. Rather than repeat myself, I’ll just paste the email announcement here:
April
-
Mojarra Gets Groovy
Today, Ryan Lubke committed code to the Mojarra tree that will allow a JSF developer to prototype and/or develop just about every JSF artifact using Groovy. When deployed to the server in development mode, the Groovy file can be changed on disk, and the changes will be picked up automatically, allowing one to avoid the compile/package/deploy cycle that can make Java web development so tedious. Once the artifact is "done," the Groovy source can be copied to a Java source file and compiled (or the build process can compile the .groovy files to .class files) for production deployment. This could be a really nice feature for component development, for example.
For more details, including a sample NetBeans project, visit Ryan’s entry.
All around, a very, very cool enhancement. Great work, Ryan!
March
-
Reintroducing the JSFTemplating FileStreamer
In a blog entry last year, Ken Paulsen gave a short introduction to the FileStreamer utility in JSFTemplating. Since Scales is now using JSFTemplating to make the component authoring process easier, I have been able to use this facility, allowing me to deprecate some custom code. In the process of making the migration, I’ve made changes to JSFTemplating that will be of benefit to all. In this entry, I’d like to highlight those changes, and show you how you, too, can use this great facility.
February
-
Web Profile Wackiness
In a recent blog post, Java EE 6 (JSR 316) specification co-lead Roberto Chinnici discussed the two leading proposals for the web profile in the upcoming Java EE 6 specification (For more information about profiles, one can start with this article on TheServerSide.) The part that caught me by surprise and confuses me greatly is why the inclusion of JavaServer Faces in the web profile would be controversial. Having spoken with an expert group member, who I will not out :), the argument comes down to this: "We shouldn’t force a broken technology, that is not the clear winner on people." I think that’s a very interesting statement, in that it precludes doing just about anything in the spec.
-
A ValueChangeListener Question and Answer
At the lunch session of the OKC JUG today, a question was asked about the difference between the valueChangeListener attribute and
<f:valueChangeListener/>
. That is,1 2 3 4
<h:selectOneMenu id="optionMenu" value="#{optionBean.selectedOption}" valueChangeListener="#{optionBean.optionChanged}" onchange="submit()"> <f:selectItems value="#{optionBean.optionList}" /> </h:selectOneMenu>
and
1 2 3 4
<h:selectOneMenu id="optionMenu" value="#{optionBean.selectedOption}" onchange="submit()"> <f:selectItems value="#{optionBean.optionList}" /> <f:valueChangeListener type: "com.mycompany.MyValueChangeListenerImpl" /> </h:selectOneMenu>
The question was, which is "better?" There was also a question if the latter form automatically handled the JS on the parent component. I will now attempt to answer those questions. :)
January
-
JSFTemplating and Woodstock: Component Authoring Made Easy
In my last post, I alluded to some refactoring done inside the Sandbox / Scales library to simplify the components' code. If you are interested in learning more about what was done, and how you can apply the same techniques to your own JSF components, please see this article, written by Ken Paulsen and myself, with editing help from Rick Palkovic, which shows how one can use JSFTemplating and some (currently "private") annotations from the Woodstock project to greatly simplify JSF component authoring. I think it’s a very interesting and helpful technique, which, by the way, resembles what JSF 2 will likely offer when we finally ship it later this year.
Oh, yeah. Happy New Year’s! :)
-
Announcing Mojarra Scales
Some of you may be wondering what the status is on the RI Sandbox. With the announcement of Project Mojarra, we can finally take the wraps off of Mojarra Scales, the promotion of the RI/Mojarra Sandbox to its own project. There are a few differences between the Sandbox of Scales to note, such as package names, namespace, etc. There has also been a fair amount of refactoring inside the library to simplify the components somewhat (more on that later). To migrate from the RI Sandbox to Mojarra Scales, you will need to do the following:
2007
December
-
Announcing Project Mojarra
It is with a pretty high degree of excitement that we, the <strike>JSF RI</strike> Mojarra development team, announce Project Mojarra. While the project itself is not new (it’s the same, high quality and stable JSF implementation we’re all familiar with ;), the announcement of the new moniker brings to an end a lengthy, and sometimes frustrating, process of deciding on a name that can pass legal muster. For more details on the name change, see this entry by Ryan Lubke.
October
-
Seam and JPA/Hibernate on OC4J 10.1.3
On a recent project, the architecture we settled on included JavaServer Faces (no surprise, there, I guess:), JBoss Seam and JPA. The production environment is Oracle’s OC4J, so the stack we chose has to deploy (easily) to that container. While I did get it working, it wasn’t easy, nor was it easily reproducible. Now that the pressures of deadlines have passed, I took the time to track down what exactly needs to be done to make the application deploy and run on OC4J. In retrospect, it doesn’t look that hard, but, knowing the pain I went through to make it work, I thought I’d share what you need to know if you’re in a similar situation.
June
-
Another RI Sandbox Progress Report
With some help from Ryan Lubke, a number of issues have been fixed in the RI Sandbox, including: * "Standard" Attribute Support * Update various CSS files * Make the tabs default to something prettier
and several minor fixes here and there. Having done that, I’ve bumped the version (which I have been awful at maintain thus the jump from 0.1 to the seemingly arbitrary 0.7) to 0.8, leaving us with this road map.
-
0.9
-
1.0
-
Post 1.0
If you have any comments, questions, suggestions, etc., please let me know here or in the issue https://javaserverfaces.dev.java.net/issues/enter_bug.cgi?issue_type: DEFECT&subcomponent=sandbox[tracker].
-
-
RI Sandbox Update: A Blogging Hat Trick
For my record setting, third blog in a single day, I thought I’d make a quick update on the state of the RI Sandbox components. Just a couple of days ago, a former coworker started asking questions about my download component, which made me realize that I should probably find some time to do some work on them. As a general rule, they’re all fairly usable, with some gotchas here and there, as Brent was discovering. Given my desire to see a 1.0 release, it’s time to address those issues.
April
-
TinyMCE Support in the Sandbox
I have just committed preliminary support for the TinyMCE JavaScript HTML editor. There are parts that still don’t work correctly, but it’s a good start.
-
JSFTemplating Meets Facelets
I could be wrong, but I think it’s safe to say that most people don’t know about JSFTemplating, which is a pity, as it’s a pretty nice alternate ViewHandler implementation from Ken Paulsen, GlassFish admin console architect. One of the coolest features, I think, is its introduction of templating events (e.g., one can attach a beforeEncode event to a component on a page and have a handler method fire before that component is encoded). The first comment I hear, though, is usually something about template syntax, and it does seem a bit foreign with things like
<!if $attribute{in} & ! (#{in} = abc) >
and <span class="code">#include /header.inc</span>. That’s where I come in.
February
-
Using the Woodstock Sortable Table
At long last, the Woodstock component set is finally here. At IEC, we have been anxiously awaiting its release for quite some time now, as we’ve been hoping to make use of the sortable data table component it offers, which we have now done. Having done it, allow me to show off the component a bit, as well as explain what I had to do make things work. It’s not hard, necessarily, just different enough to give one pause at first glance.
-
Sandbox Demo and Nightlies Available
Thanks to the generosity of Ryan Lubke, Ed Burns and the javaserver.org folks, the Sandbox demo application, which can be found in the Sandbox source tree, is now available online. There are a couple of known issues with it, but it should give you a good sense of the current state of the components.
We also have nightly snapshots of the sandbox source, binaries and demo available on the RI website. If you find any issues, please file an issue on the <a href="https://javaserverfaces.dev.java.net/issues/enter_bug.cgi?subcomponent=sandbox&version=current">tracker</a>.
January
-
JSF RI Sandbox FileDownload Component Changes
Today I checked in a couple of changes to the RI Sandbox file download component that will make the component more flexible, and, therefore, more usable.
2006
December
-
Yahoo! UI and JSF Update
I’ve had several people ask for an update on where things stand with my YUI components and their JSF component wrappers, so I figure I should take the time to answer that question.
-
Download and Multi-file Upload JSF Components
At work, we have run into two issues several times: 1) We haves app that create PDFs, and we need our JSF apps to send that to the user, and 2) we need to be able to upload multiple files to one of our JSF apps. The solutions we’ve used have been less than exciting. For the first problem, we’d make the backing bean that coordinates the PDF creation (calling the service layer, basically) session-scoped, then have a hidden iframe on the result page whose source is a JSP that pulls the bean out the session (via Java code!) and sends the PDF to the browser in such a way that forces the user to save the file. For the upload issue, we’ve been using JUpload, which works fine, but, since it lives outside the JSF lifecycle, we have to do some interesting things to make it work. Luckily, my boss gave me time to create better solutions, resulting in the components
<fl:download/>
and<fl:multiFileUpload/>
.
November
-
Using Acegi Security With JSF
A question that often comes up in when looking through JSF <a target="blank" href="http://forum.java.sun.com/forum.jspa?forumID=427&start=0">forums</a> or idling on IRC is, "How do I secure my JSF app?" to which, of course, there are a myriad of options. At <a target="blank" href="http://www.iec-okc.com">IEC</a>, we use <a target="blank" href="http://www.acegisecurity.org/">Acegi Security</a>. That answers only part of the "how," though, as Acegi is not the easiest thing to learn. In this blog entry, I’ll detail how we have Acegi implemented at IEC. While it’s not perfect, it works well for us, and should be enough to get someone moving in the right direction.
October
-
Review: Building Ajax JSF Components
If you’re doing web development, you have likely at least heard of Ajax, and, if you’re not currently using it, you’ve likely investigated its possible use. One of the tricky aspects of working with a technology like Ajax is integrating it with various frameworks. JavaServer Faces, now a standard part of the Java EE stack, is no different. For both a page and component author, the integration issue can be a big question. Luckily for those of us in the JSF world, that question has been addressed by Chris Schalk and Ed Burns, in their new book JavaServer Faces: The Complete Reference.
August
-
JSF, PhaseListeners, and GET Requests Redux
In an earlier post, I detailed how my company got around JSF’s dependence on POST requests in our efforts to implement pretty URLs. While this approach has worked well for us for quite some time, a pretty major flaw in the approach revealed itself to us in the past few days.
July
-
Debugging jsf-extensions
One of the things that has been frustrating with trying to come up to speed with jsf-extensions is that I just didn’t know where to look in all the Javascript involved to see what was going on. Today, I "watched" as Ed Burns walked a fellow extensions learner through debugging his app. Here’s what I learned.
-
Ajaxifiying JSF
In October, I will be presenting Ajax at the <a target="_newwindow" href="http://wiki.okcjug.org">Oklahoma City Java Users Group</a>, of which I am a member (and vice president now, by the way, for what that’s worth). As I’ve prepared for that talk, I’ve thought quite a bit about the web apps I write, which are, for the most part, pretty boring. I like to think that they’re functional, but I have to admit that they’re pretty plain. Ajax, though, along with the Javascript pretties that usually accompany an Ajaxified application, is a good way of fixing that "problem", assuming it’s done properly. That line of thinking has affected how I’ve approached a new app I started at work, but finding a library that works well with JSF (read as, in a JSF-friendly manner) has been a bit of a challenge.
May
-
Yahoo! UI Meets JavaServer Faces
In my ongoing efforts to learn the JSF framework as thoroughly as possible, I decided to write a component, but, with the myriad of high quality components available, what was left for me to do? :P At the suggestion of my brother, who has been watching a similar effort underway in the Wicket space, I’ve decided to wrap Yahoo’s UI library. The problem I ran into pretty quickly, though, was that the documentation wasn’t too clear as to what I needed to make it happen (though it’s quite likely I was having an obtuse moment or three). There are a plethora of resources that discuss what needs to be done, but all seemed either incomplete or too disjointed (see disclaimer above). So, to help ameliorate that, let’s walk through wrapping Yahoo’s calendar component as a JSF component, step by step. Before I go much further, though, I must note that I am by no means an expert in this, so it’s likely that you’re going to see some less than ideal examples. So, without further ado…
-
FacesUtil: A missing, yet important piece
A reader brought to my attention that I have never posted the code to FacesUtil, a convenience class used, for example, in my JSF, PhaseListeners, and GET Requests article, so I’ll fix that oversight now. Before I get to the code, though, let me preface it by saying this: This code has grown as several developers have hacked on it, so it my not be consistent, and probably doesn’t embody any sort of best practices. It does, however, work well for us, and that’s our primary concern. :) Note also, that this code has not been updated to the 1.2 specification yet, so you’ll at least get warnings if not errors should you use this in a 1.2 environment. I am currently in the process of updating the class, but, for now, here it is in its current state.
-
Embedding JSF with Winstone
Sometimes, when developing a JSF application, it would be nice not to have to wait for your favorite container to start up. That’s especially true if your container is a full JEE stack like GlassFish or JBoss. Likewise, there are times when you might need to embed a web application in another, say some server process or desktop application. While there are a number of options available, I’d like to demonstrate how to embed a simple JSF application using the Winstone Servlet Container. To help demonstrate how this is done, we’ll use a well know sample application: Duke’s guessNumber game, and, to make things even more interesting, we’ll convert the application to use Facelets (mostly because I love Facelets, but partly because I didn’t care to figure out how to make Winstone compile JSPs ;) ).
April
-
JSF, PhaseListeners, and GET Requests
UPDATE: For a missing piece of code, please see this entry.
In one of our applications at work, we needed to be able to deep link to certain pages to allow external applications to get at specific pieces of data, product and order information to be specific. Since JSF 1.x does not support HTTP GET requests, this poses a problem. In order to get (no pun intended) information to the backing bean for processing, the data would have to be POSTed. This obviously makes bookmarking the resulting page useless. Our initial solution was to write a servlet filter which would get a reference to the current FacesContext, then get a reference to the appropriate JSF managed bean, and pump data into it. This actually worked rather well, but, at Ed Burns' suggestion, I decided to reimplement this a JSF PhaseListener (many thanks to Ryan Lubke for his help!). A PhaseListener is "an interface implemented by objects that wish to be notified at the beginning and ending of processing for each standard phase of the request processing lifecycle."
-
JSF and Annotations
Recently at work, we looked, ever so briefly, at a new web framework called Stripes. It looked rather cool, as it was largely annotation-based, but, given its glaring lack of any wide-spread usage, we never seriously considered it. Today, I was on The Server Side (you do read TSS, right? ;) ) and noticed that Struts has released a Java 5 addon. One of the additions is annotation support whose only problem appears to be that it’s tied to Struts (that’s a joke ;) ).
-
JSF and File Downloads, Take Two
Yesterday, I detailed some issues I was having getting a JSF app to allow the download of an Excel spreadsheet as the result of a backing bean action being called. My solution involved a servlet and some JavaScript, with just a -pinch- a fistful of kludge.
- JSF and File Downloads