Showing posts with label jsf. Show all posts
Showing posts with label jsf. Show all posts

Saturday, May 13, 2006

When will Shale release ?

It's just interesting... Shale is a pretty high profile apache project and it's probably more than a year old... Looking at the shale project site, the majority of the packages and pieces of shale are still not co sidered production quality with most of the api-s not considered stable. Now, looking st what shale has to offer, and considering my experience (and a partial disappointment) with jsf, i do believe that shale will be açcepted very well, because just like struts proper it will offer a bunch of useful abstractions and utilities on top of the standard that would make it useful and popular. So, here is the paradox: there are smart and experienced people who are working on the project, probably all of them see the usefullness of what shale could be.... And ýet, for such a long time, the project has not released a stable version. On one hand I understand that having ¨struts¨ in the of the project does bring a lot of responsibility and baggage and there might be a desire to get everything to be perfect or at least excellent when 1.0 is released. On the other hand, i understand that it is an open source project and it largely depends on volunteer contributions of time and effort ( and thus, instead of blogging i probably should be reading and writing code for shale). On the other hand, it seems to me that is doesn't have to be perfect for 1.0 - it just has to be goood enough in order to be useful to a lot of people and then with usage it will start to get exponentially better....

so, my question still is : why isn't there a struts shale 1.0 yet??

Kudos to Jacob Hookom

A number of years ago while I was still in college.. one of my cool professors was raving about some guy who managed to connect to his cell phone from his home machine in some very sneaky and cool way.. So, my professor's comment was something like "Well, some people might say, who the hell cares about somebody connecting to a cell phone... But damn, it makes me sleep well at night when I know this kind of people are out there.. "...

So, the connection to JHook... He's the lead of the Facelets project.. and he is involved with the JSF spec committee.. He's coming up with these great ideas about web applications, components, JSF, Ajax + JSF... stuff like that.. Reading his blog is just a pleasure.. and it constantly makes me think "Thank god people like him are out there..."...

JSF early adopter...

I know that I am not too early in the adoption cycle for JSF.. but it's funny, cause it feels that way.. I mean that I learned struts when it was already quite popular (although I think a little before it peaked in popularity), and there were already a good number of books, tutorials, etc. Not with JSF - there are a lot resources on how to do stuff, however, there is no "definitive" best practices that have existed with Struts in a while.. and so many different things just kinda seem half baked in JSF.. I mean, I understand that it was designed to have "tool support" and so on.. but really, there needs to be a package (e.g. maybe Shale) that would provide a layer on top of JSF that resolves the trivial and middle-of-the road problems in a nice way, just like Struts did the same for servlet programming.. I mean, before Struts, everyone was hacking out their own little solutions, and had their own way of dealing with http requests and responses, form submissions, validations, etc.. and now with JSF, there are a couple of different ways to solve the same problem..

Here is an example - dealing with row selection in an h:dataTable :
1. One possible way to solve it is to write a custom component, just like ibm did in this explanation . But really, how many people who don't use WebSphere would actually sit down and write their own component for that (especially considering that JSF components are notoriously difficult to do.

2. There was another post on the Sun JSF forums, where none other than CraigMcc responded to a question on how to do it (took a bit of digging
* Option#1 was to have a bolean property in the actual bean that you're iterating over, to indicate that the bean was selected. That is not very pleasant to use, as first, you might have to wrap your regular beans into a bean that has boolean property..
* Option #2 is to bind a datatable to the backing bean, bind a checkbox to the backing bean, and then on submit, actually iterate over the dataTable, and check the value of the h:selectBooleanCheckbox on each iteration . Now, this is pretty simple and straightforward, with the only downside that you definitely bind your backing bean to the JSF API (which is generally frowned upon, but then on 2nd thought, the backing bean is generally tied to the framework api anyways for whatever framework you're using). Now, the thing that kinda pissed me off was that after reading the two books that I mentioned in the previous post, I really had no clue that it would work that way - that the single checkbox that's bound into a single (not array) backing bean property, would change it's "selected" value based on how you iterate inside the h:dataTable .I kinda liked this solution the most.

3. In the appropriate column in the dataTable, include a verbatim html input checkbox. Then, when you're processing the submit in the backing bean, retrieve the request params with the same name as the checkbox, and you will get a string array with the checkbox values. Not a bad solution as you get everything you need, with the downside that you have to muck around with the request... (this option and a couple of other ones are discussed in more detail here

So, there it is.. there are a few different ways to solve this problem that should really be something trivial... and none of them are particularly straightforward....

Friday, May 12, 2006

JSF dirty little secrets

I've been working pretty intensively with JSF for the last couple of weeks on a couple of different projects. I usually read a couple of books before I dig into a technology in order to get a good understanding of how it works, how it does things, etc. So, a couple of months ago, I read 2 books on JSF, looked at a couple of tutorials, and gave it a shot. The first couple of apps were pretty straightforward, and since I never did anything particularly complicated, it worked OK. This time around, the sh*t really hit the fan.. Not that I was doing anything particularly complicated, but it was outside of the "really easy" stuff that is in all the tutorials and books... And all of I sudden, I started finding these "dirty little secrets" that each technology has, that one hopes to either never encounter, or to possibly be able to find a half-decent solution. I really would like to learn more about it, but I was surprised very unpleasantly to start hitting these roadblocks so early in learning about the technology.. I mean, JSF was supposed to make the developers' lives easier... and that is the case for 10% of the most trivial cases..

The other thing that really bugs me is the amount and depth of material that is covered in the JSF books that I have... ("Core JSF" and "JSF in Action"). I mean that it seems that the authors intentionally picked up examples that were in the 10% "easy" zone, where none of the ugliness shows.. I mean, I would have thought that in an effort to make their books useful, the authors would try to cover a few examples that go beyond the trivial stuff. Now, it's not like they don't show you any of the "advanced" stuff like building your own components.. they do, but the basic stuff is really so basic and they don't give examples or useful workaround to the middle of the road practical problems that one encounters...

I will go back to the example that I spent a lot of time on.. and I will try to post the problem, solution, and the explanation..

Popular Posts

Related Posts with Thumbnails