Another thing I noticed: The ResponseWriter provides method for writing HTML markup, but requires that nearly every call passes a "component" or "propertyname". In almost all cases those are completely unnecessary and not even used anywhere.
I've written my own wrapper to skip all those additionals nulls: public class ResponseWriterWrapper { private ResponseWriter original; public ResponseWriterWrapper(ResponseWriter toWrap) { this.original = toWrap; } public void startElement(String name) throws IOException { original.startElement(name, null); } public void writeAttribute(String name, String value) throws IOException { original.writeAttribute(name, value, null); } public void endElement(String name) throws IOException { original.endElement(name); } public void writeText(String string) throws IOException { original.writeText(string, null); } } On 3/16/07, Martin Marinschek <[EMAIL PROTECTED]> wrote:
Good idea! regards, Martin On 3/16/07, Adrian Mitev <[EMAIL PROTECTED]> wrote: > I've posted RFE for jsf 2.0 [1] about api for component development. > > https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=246 > > 2007/3/15, Jörn Zaefferer <[EMAIL PROTECTED]>: > > Absolutely! The JSF API itself isn't enough to write components without > duplicating tons of code. You either do duplication, or depend on a > particular implementation of the API. > > > > And this isn't just a problem with JSF alone. I wanted to replace the > default month renderer on tomahawks schedule component. I've now ended by > extending Renderer directly, I can't even reuse a single line of the > AbstractWhateverScheduleRenderers. Instead I have to > duplicate parts of them in my own renderer. > > > > About the three classes: When I want to quickly create my own component > for handle a particular problem, I need only the component class itself and > my facelets taglib. The component can do the rendering. > > > > Once I'd have those components ready to publish to a greater audience I > wouldn't mind writing renderer and tag classes. > > > > > > On 3/15/07, Werner Punz <[EMAIL PROTECTED]> wrote: > > > Jeff Bischoff schrieb: > > > > I agree, it would be great if that were part of the distro. Problem > is, > > > > Facelets still isn't officially supported by Tomahawk, and thus > > > > developers don't have to ensure their components will work in > Facelets, > > > > let alone provide the configuration and handler classes. Seems like a > > > > huge number of the userbase is already using or migrating to Facelets, > > > > though, so I would expect to see Facelet support improve over time. > This > > > > is, of course, a community project! > > > > > > > Getting away from the discussion itself... > > > > > > Actually having facelets in would be a great welcome for the component > > > devs too, I have been playing around with the thought of having parts > > > of the stuff I am doing being moved into the facelets domain, sort of > > > like a tomahawk facelets. > > > Problem is I cannot do it in the borders of the Tomahawk project > > > currently because those components would only work with facelets. > > > (There was a discussion in the myfaces list a while ago) > > > > > > I will give a description of the core problem. > > > > > > Simple JSF control == 3 classes (one tag class, one component class, one > > > renderer clasS) > > > two xml file entries > > > > > > each class is 100 locs code min and the renderer uses > > > a crude servlet like outputwriter api to the worst. > > > 90% of this code normally is just glue code. > > > > > > 90% of most of this code probably could be replaced by simply facelet > > > tags and only specialized stuff would have to be coded in the component > > > api itself. > > > > > > The component api probably is the biggest problem JSF has in my opinion > > > and it prevents a lot of people jumping onto the ship. > > > Facelets would be an easy entry point to add new components. > > > > > > > > > Heck everything which makes things easier and helps people to ease > > > coding is welcome, it does not have to be facelets. > > > > > > > > > > > > -- http://www.irian.at Your JSF powerhouse - JSF Consulting, Development and Courses in English and German Professional Support for Apache MyFaces