FAQ
Wrote up my solution for a JSF combo box - and yes, this is a shameless, egotistical plug for my blog, but the solution is sound. Click on the link. You know you want to!

http://mytechhell.com/blog/archives/432

Suggestions, corrections, and relevant puns greatly accepted and sometimes even appreciated...
___________________________________________________________
John O'Grady
Dragon Tamer

Human beings, who are almost unique in having the ability to learn
from the experience of others, are also remarkable for their apparent
disinclination to do so.
- Douglas Adams

Those who do not learn from history are doomed to repeat it.
- George Santayana

Qui tacet consentit
(Silence implies consent)
___________________________________________________________

Search Discussions

  • Jakob Korherr at Jan 13, 2010 at 7:51 pm
    Hi John,

    I think it would be better for yourself to (try to) understand the concepts
    of JSF's standard components first, before you write a blog post in which
    you do nothing but swearing about JSF.

    If you use an UISelect component, then you have to be aware of the fact that
    this component matches the submitted values against the possible values. So
    it has to be a hardcoded validation.

    So if you want a component, which does not check this, you should use the an
    UIInput component (like HtmlInputText).

    Furthermore if you want to implement a combo box for JSF, it would be A LOT
    better to write a custom component then to use the binding attribute to
    inject strage code into the component. But that's a thing you would know, if
    you'd understand JSF, which you clearly don't. No offence.

    You might want to take a look at the some online books about JSF, like
    http://jsfatwork.irian.at/semistatic/introduction.html (written in German).

    Regards,
    Jakob


    2010/1/13 Ogrady, John <john.ogrady@citi.com>
    Wrote up my solution for a JSF combo box - and yes, this is a shameless,
    egotistical plug for my blog, but the solution is sound. Click on the link.
    You know you want to!

    http://mytechhell.com/blog/archives/432

    Suggestions, corrections, and relevant puns greatly accepted and sometimes
    even appreciated...
    ___________________________________________________________
    John O'Grady
    Dragon Tamer

    Human beings, who are almost unique in having the ability to learn
    from the experience of others, are also remarkable for their apparent
    disinclination to do so.
    - Douglas Adams

    Those who do not learn from history are doomed to repeat it.
    - George Santayana

    Qui tacet consentit
    (Silence implies consent)
    ___________________________________________________________
  • Ogrady, John at Jan 13, 2010 at 8:19 pm
    Oh, I'm not really mad at JSF, though I do think it is a much more complicated framework to deal with than Spring MVC, for instance. It's much like using ANT or PHP - there's a size threshold your project seems to cross where suddenly it's taking longer to figure out what badness the framework is doing than to actually be productive. I'll caveat that with the fact that I've only used JSF 1.1 spec frameworks, and I'm sure 1.2 and 2.0 spec are probably easier to use and understand.

    As to the using something other than a component that generates an HTML select element, the whole point of the article is that there is no combobox component implementation for JSF, and those of us that work for a living and have families simply don't have the time to write one ourselves, and so I've shared this shortcut I figured out that can save developers a lot of time. If I used the UIInput as you suggested, ExtJS would not be able to create a proper combobox from it, and so the UISelect extended SelectOneMenu was the only option. Yes ExtJS injects "strange" code, but I've found it to work nicely and play well with all the JSF functionality so far, so what's the harm?

    I don't agree that the submitted option matching validation had to be hardcoded. That code could have been implemented as a default validator that could be removed by the implementor, thereby giving the API users full control over what validation was done when and to what. Again, this is for the 1.1 implementation, and I don't know what the >1.1 versions do.

    As for taking offence, I rarely do. If JSF's learning curve is so high it takes weeks to understand it properly, and if I've found every other framework I've worked with - Spring MVC, Struts 1.x, Struts 2.x, Webwork, Stripes, Wicket, and Django (during my summer flirtation with python) to be easier to understand, implement, and manage, then yes, I do not understand JSF very well at all. And you know what? - that's ok! If you find JSF to be your alpha and omega framework, then I'm happy for you. As for me, JSF is costing me time while trying to figure out stuff that is "Intuitively Obvious To The Most Casual Observer" in most other frameworks. And yet at the end of the day, I get paid for the time I've spent working through the source, so I'm not really bothered by it.

    I'll leave you with a quote by Alexander Pope:
    "At every trifle take offence, that always shows great pride or little sense."

    ___________________________________________________________
    John O'Grady, Dragon Tamer
    The important thing is not to stop questioning. - Albert Einstein
    ___________________________________________________________


    -----Original Message-----
    From: sethfromaustria@gmail.com On Behalf Of Jakob Korherr
    Sent: Wednesday, January 13, 2010 2:51 PM
    To: MyFaces Discussion
    Subject: Re: JSF Combo Box for MyFaces 1.1 - one humble developer's solution

    Hi John,

    I think it would be better for yourself to (try to) understand the concepts of JSF's standard components first, before you write a blog post in which you do nothing but swearing about JSF.

    If you use an UISelect component, then you have to be aware of the fact that this component matches the submitted values against the possible values. So it has to be a hardcoded validation.

    So if you want a component, which does not check this, you should use the an UIInput component (like HtmlInputText).

    Furthermore if you want to implement a combo box for JSF, it would be A LOT better to write a custom component then to use the binding attribute to inject strage code into the component. But that's a thing you would know, if you'd understand JSF, which you clearly don't. No offence.

    You might want to take a look at the some online books about JSF, like http://jsfatwork.irian.at/semistatic/introduction.html (written in German).

    Regards,
    Jakob


    2010/1/13 Ogrady, John <john.ogrady@citi.com>
    Wrote up my solution for a JSF combo box - and yes, this is a
    shameless, egotistical plug for my blog, but the solution is sound. Click on the link.
    You know you want to!

    http://mytechhell.com/blog/archives/432

    Suggestions, corrections, and relevant puns greatly accepted and
    sometimes even appreciated...
    ___________________________________________________________
    John O'Grady
    Dragon Tamer

    Human beings, who are almost unique in having the ability to learn
    from the experience of others, are also remarkable for their apparent
    disinclination to do so.
    - Douglas Adams

    Those who do not learn from history are doomed to repeat it.
    - George Santayana

    Qui tacet consentit
    (Silence implies consent)
    ___________________________________________________________
  • Mike Kienenberger at Jan 13, 2010 at 8:57 pm

    On Wed, Jan 13, 2010 at 3:19 PM, Ogrady, John wrote:
    As to the using something other than a component that generates an HTML select element, the whole point of the article is that there is no combobox component implementation for JSF, and those of us that work for a living and have families simply don't have the time to write one ourselves, and so I've shared this shortcut I figured out that can save developers a lot of time.  If I used the UIInput as you suggested, ExtJS would not be able to create a proper combobox from it, and so the UISelect extended SelectOneMenu was the only option.  Yes ExtJS injects "strange" code, but I've found it to work nicely and play well with all the JSF functionality so far, so what's the harm?

    Rather than spend 16 hours on a hack, why not spend 30 minutes writing
    a component? Custom components aren't part of "the framework".
    They're part of your code. It's a natural extension point for JSF
    application code.

    If you're using JSF, writing custom components is part of "working for
    a living", just like writing validators and actions is part of writing
    a struts application. It's kinda like complaining you have to write
    action methods for your UICommands.

    Yes, it takes a few more minutes to write a real component (or fake
    one up in facelets), but once you do it, it's there to be used for all
    time, trivially.
  • Ogradyjd at Jan 14, 2010 at 12:19 am
    Wow - I'm really amazed at the reaction I'm getting here. Let me boil it
    down for everyone:

    1) I wasn't allowed to introduce a new JSF UI framework into the
    architecture. Tomahawk was it.
    2) It seems only Richfaces has a combobox component. If writing one is so
    easy as everyone here seems to be implying, why is that?
    3) The Richfaces combobox component was only introduced in the 3.2.x
    versions. Richfaces 3.2 and above require at least a JSF 1.2 implementation.
    I'm stuck with MyFaces 1.1, like many corporate developers out there.
    4) Writing my own combobox component that could come close to the
    functionality of the ExtJS combobox would not only be reinventing the wheel,
    but would also have consumed a lot more than 16 hours. If you can do it in
    30 minutes, prove it. Then give your code to Icefaces, Tomahawk, and
    Facelets because apparently they could use it.

    If I'm wrong with any of what I've stated above, feel free to correct me. I
    am really wondering why this community seems to be so hostile to using
    another UI library to fix what seems to be a gaping hole in the JSF UI
    component cadre. Did I step into a "vi vs emacs" type holy war here?



    Mike Kienenberger wrote:
    Rather than spend 16 hours on a hack, why not spend 30 minutes writing
    a component? Custom components aren't part of "the framework".
    They're part of your code. It's a natural extension point for JSF
    application code.

    If you're using JSF, writing custom components is part of "working for
    a living", just like writing validators and actions is part of writing
    a struts application. It's kinda like complaining you have to write
    action methods for your UICommands.

    Yes, it takes a few more minutes to write a real component (or fake
    one up in facelets), but once you do it, it's there to be used for all
    time, trivially.
    --
    View this message in context: http://old.nabble.com/JSF-Combo-Box-for-MyFaces-1.1---one-humble-developer%27s-solution-tp27150321p27154397.html
    Sent from the MyFaces - Users mailing list archive at Nabble.com.
  • Mike Kienenberger at Jan 14, 2010 at 12:24 am
    If you use a screwdriver as a hammer, it might work.
    But it won't work as well as a hammer :)

    You don't have to reinvent the wheel. Just write a JSF component
    wrapper around ExtJs combobox. Most of the ajax components in
    tomahawk are just wrappers around dojo and other ajax components.
    On Wed, Jan 13, 2010 at 7:19 PM, ogradyjd wrote:

    Wow - I'm really amazed at the reaction I'm getting here.  Let me boil it
    down for everyone:

    1) I wasn't allowed to introduce a new JSF UI framework into the
    architecture. Tomahawk was it.
    2) It seems only Richfaces has a combobox component.  If writing one is so
    easy as everyone here seems to be implying, why is that?
    3) The Richfaces combobox component was only introduced in the 3.2.x
    versions. Richfaces 3.2 and above require at least a JSF 1.2 implementation.
    I'm stuck with MyFaces 1.1, like many corporate developers out there.
    4) Writing my own combobox component that could come close to the
    functionality of the ExtJS combobox would not only be reinventing the wheel,
    but would also have consumed a lot more than 16 hours.  If you can do it in
    30 minutes, prove it.  Then give your code to Icefaces, Tomahawk, and
    Facelets because apparently they could use it.

    If I'm wrong with any of what I've stated above, feel free to correct me. I
    am really wondering why this community seems to be so hostile to using
    another UI library to fix what seems to be a gaping hole in the JSF UI
    component cadre.  Did I step into a "vi vs emacs" type holy war here?



    Mike Kienenberger wrote:
    Rather than spend 16 hours on a hack, why not spend 30 minutes writing
    a component?  Custom components aren't part of "the framework".
    They're part of your code.  It's a natural extension point for JSF
    application code.

    If you're using JSF, writing custom components is part of "working for
    a living", just like writing validators and actions is part of writing
    a struts application.  It's kinda like complaining you have to write
    action methods for your UICommands.

    Yes, it takes a few more minutes to write a real component (or fake
    one up in facelets), but once you do it, it's there to be used for all
    time, trivially.
    --
    View this message in context: http://old.nabble.com/JSF-Combo-Box-for-MyFaces-1.1---one-humble-developer%27s-solution-tp27150321p27154397.html
    Sent from the MyFaces - Users mailing list archive at Nabble.com.
  • Jakob Korherr at Jan 14, 2010 at 9:48 am
    We are not criticizing what you did, but how you did it. As Mike wrote,
    write a wrapper Component around the ExtJs Combobox. It can't take you more
    than 30 minutes and is a clean solution to your problem.


    2010/1/14 Mike Kienenberger <mkienenb@gmail.com>
    If you use a screwdriver as a hammer, it might work.
    But it won't work as well as a hammer :)

    You don't have to reinvent the wheel. Just write a JSF component
    wrapper around ExtJs combobox. Most of the ajax components in
    tomahawk are just wrappers around dojo and other ajax components.
    On Wed, Jan 13, 2010 at 7:19 PM, ogradyjd wrote:

    Wow - I'm really amazed at the reaction I'm getting here. Let me boil it
    down for everyone:

    1) I wasn't allowed to introduce a new JSF UI framework into the
    architecture. Tomahawk was it.
    2) It seems only Richfaces has a combobox component. If writing one is so
    easy as everyone here seems to be implying, why is that?
    3) The Richfaces combobox component was only introduced in the 3.2.x
    versions. Richfaces 3.2 and above require at least a JSF 1.2
    implementation.
    I'm stuck with MyFaces 1.1, like many corporate developers out there.
    4) Writing my own combobox component that could come close to the
    functionality of the ExtJS combobox would not only be reinventing the wheel,
    but would also have consumed a lot more than 16 hours. If you can do it in
    30 minutes, prove it. Then give your code to Icefaces, Tomahawk, and
    Facelets because apparently they could use it.

    If I'm wrong with any of what I've stated above, feel free to correct me. I
    am really wondering why this community seems to be so hostile to using
    another UI library to fix what seems to be a gaping hole in the JSF UI
    component cadre. Did I step into a "vi vs emacs" type holy war here?



    Mike Kienenberger wrote:
    Rather than spend 16 hours on a hack, why not spend 30 minutes writing
    a component? Custom components aren't part of "the framework".
    They're part of your code. It's a natural extension point for JSF
    application code.

    If you're using JSF, writing custom components is part of "working for
    a living", just like writing validators and actions is part of writing
    a struts application. It's kinda like complaining you have to write
    action methods for your UICommands.

    Yes, it takes a few more minutes to write a real component (or fake
    one up in facelets), but once you do it, it's there to be used for all
    time, trivially.
    --
    View this message in context:
    http://old.nabble.com/JSF-Combo-Box-for-MyFaces-1.1---one-humble-developer%27s-solution-tp27150321p27154397.html
    Sent from the MyFaces - Users mailing list archive at Nabble.com.
  • Mike Kienenberger at Jan 14, 2010 at 6:30 pm

    On Wed, Jan 13, 2010 at 7:19 PM, ogradyjd wrote:
    4) Writing my own combobox component that could come close to the
    functionality of the ExtJS combobox would not only be reinventing the wheel,
    but would also have consumed a lot more than 16 hours.  If you can do it in
    30 minutes, prove it.
    Fair enough.

    It took me more like an hour and 45 minutes because I don't really
    know much javascript, I have no familiarity with ExtJs, and I've never
    had to write a JSF renderer before. Not to mention I haven't written
    a JSF component in about a year or so.

    This project needs Myfaces 1.2.8 core/api and Tomahawk 1.1.9 and
    Facelets 1.1.14 jars to run. And their dependencies -- The rest of
    the files came out of the tomahawk example blank project which is what
    I used as a base.

    I couldn't actually figure out how to make the Extjs combo pulldown
    part display right, but the html/javascript it generates seems to
    match the code on the extjs combos page. I'm not sure if it's
    because it couldn't find the js libs or some other setup issue.

    http://www.extjs.com/deploy/dev/examples/form/combos.html

    I wasted probably 45 minutes trying to figure that out. It's probably
    something trivial I'm missing. So figure the actual component took an
    hour to write. I should have just accepted that what I did was close
    enough and sent this out a while ago :)

    You'd probably want to spend another hour adding nice things like
    supporting every possible combobox option, but what I put together
    demonstrates all of the basic things you'd do, and handles what I had
    thought would be the hardest part of dealing with selectItem children
    (although I used a Tomahawk utility class to deal with constructing
    the SelectItem list, although I looked at the code in Tomahawk, and
    it's pretty trivial.)

    Also, my rendering code is really bad. It should use
    writeElement/writeAttribute and all that fun stuff rather than raw
    writes, but that's just cleanup someone who actually wants to use the
    component can work through.

    jsfexample.zip (application/zip) 204K

    -Mike
  • Günther, Rene - Innflow AG at Jan 13, 2010 at 8:25 pm
    Hi Jakob,
    If you use an UISelect component, then you have to be aware of the fact that this component matches the submitted values against the possible > values. So it has to be a hardcoded validation.
    I once recognized that too. Is that related to assure data consistency and provide some security (prevent tampering of form fields)?

    Cheers
    Rene


    -----Ursprüngliche Nachricht-----
    Von: sethfromaustria@gmail.com Im Auftrag von Jakob Korherr
    Gesendet: Mittwoch, 13. Januar 2010 20:51
    An: MyFaces Discussion
    Betreff: Re: JSF Combo Box for MyFaces 1.1 - one humble developer's solution

    Hi John,

    I think it would be better for yourself to (try to) understand the concepts
    of JSF's standard components first, before you write a blog post in which
    you do nothing but swearing about JSF.

    If you use an UISelect component, then you have to be aware of the fact that
    this component matches the submitted values against the possible values. So
    it has to be a hardcoded validation.

    So if you want a component, which does not check this, you should use the an
    UIInput component (like HtmlInputText).

    Furthermore if you want to implement a combo box for JSF, it would be A LOT
    better to write a custom component then to use the binding attribute to
    inject strage code into the component. But that's a thing you would know, if
    you'd understand JSF, which you clearly don't. No offence.

    You might want to take a look at the some online books about JSF, like
    http://jsfatwork.irian.at/semistatic/introduction.html (written in German).

    Regards,
    Jakob


    2010/1/13 Ogrady, John <john.ogrady@citi.com>
    Wrote up my solution for a JSF combo box - and yes, this is a shameless,
    egotistical plug for my blog, but the solution is sound. Click on the link.
    You know you want to!

    http://mytechhell.com/blog/archives/432

    Suggestions, corrections, and relevant puns greatly accepted and sometimes
    even appreciated...
    ___________________________________________________________
    John O'Grady
    Dragon Tamer

    Human beings, who are almost unique in having the ability to learn
    from the experience of others, are also remarkable for their apparent
    disinclination to do so.
    - Douglas Adams

    Those who do not learn from history are doomed to repeat it.
    - George Santayana

    Qui tacet consentit
    (Silence implies consent)
    ___________________________________________________________
  • Jakob Korherr at Jan 13, 2010 at 8:40 pm
    Hi,

    Günther: Yes, that's the reason!

    John,

    I'm sorry. I did not mean to offend you.

    I guess, I was just upset, because you clearly missed some key points of JSF
    and your way to deal with it was swearing. I can't remember, but did you
    ever post your problem (or your need for a combobox) to the mailing list? I
    guess not, because you would definitely have gotten a better solution.

    The best solution to your problem would be to write your own component
    (maybe by extending UISelect). So you would be able to change the components
    behavior in a real component class rather then in your managed bean and via
    the binding attribute.
    I did that myself a couple of times for JSF 1.1, and it is really not that
    hard!

    Maybe you could somehow mention that in your blogpost, because I think that
    no one wants that a poor solution of a problem makes its way around the
    internet. You wouldn't want that yourself, would you?

    And I think that there's no such thing as the "alpha and omega framework".
    Every framework has its pros and cons.

    Again, I'm sorry.

    Regards,
    Jakob


    2010/1/13 "Günther, Rene - Innflow AG" <rene.guenther@innflow.com>
    Hi Jakob,
    If you use an UISelect component, then you have to be aware of the fact
    that this component matches the submitted values against the possible >
    values. So it has to be a hardcoded validation.

    I once recognized that too. Is that related to assure data consistency and
    provide some security (prevent tampering of form fields)?

    Cheers
    Rene


    -----Ursprüngliche Nachricht-----
    Von: sethfromaustria@gmail.com Im
    Auftrag von Jakob Korherr
    Gesendet: Mittwoch, 13. Januar 2010 20:51
    An: MyFaces Discussion
    Betreff: Re: JSF Combo Box for MyFaces 1.1 - one humble developer's
    solution

    Hi John,

    I think it would be better for yourself to (try to) understand the concepts
    of JSF's standard components first, before you write a blog post in which
    you do nothing but swearing about JSF.

    If you use an UISelect component, then you have to be aware of the fact
    that
    this component matches the submitted values against the possible values. So
    it has to be a hardcoded validation.

    So if you want a component, which does not check this, you should use the
    an
    UIInput component (like HtmlInputText).

    Furthermore if you want to implement a combo box for JSF, it would be A LOT
    better to write a custom component then to use the binding attribute to
    inject strage code into the component. But that's a thing you would know,
    if
    you'd understand JSF, which you clearly don't. No offence.

    You might want to take a look at the some online books about JSF, like
    http://jsfatwork.irian.at/semistatic/introduction.html (written in
    German).

    Regards,
    Jakob


    2010/1/13 Ogrady, John <john.ogrady@citi.com>
    Wrote up my solution for a JSF combo box - and yes, this is a shameless,
    egotistical plug for my blog, but the solution is sound. Click on the link.
    You know you want to!

    http://mytechhell.com/blog/archives/432

    Suggestions, corrections, and relevant puns greatly accepted and sometimes
    even appreciated...
    ___________________________________________________________
    John O'Grady
    Dragon Tamer

    Human beings, who are almost unique in having the ability to learn
    from the experience of others, are also remarkable for their apparent
    disinclination to do so.
    - Douglas Adams

    Those who do not learn from history are doomed to repeat it.
    - George Santayana

    Qui tacet consentit
    (Silence implies consent)
    ___________________________________________________________

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupusers @
categoriesmyfaces
postedJan 13, '10 at 7:14p
activeJan 14, '10 at 6:30p
posts10
users5
websitemyfaces.apache.org

People

Translate

site design / logo © 2019 Grokbase