Women in Technology

Hear us Roar



Article:
  Improving JSF by Dumping JSP
Subject:   Attributing blame
Date:   2004-06-10 12:28:23
From:   BigBadaboom
When you describe the problem of using JSPs and JSF together, you seem to blame JSPs. It seems to me that the fault isn't really with JSPs or tag libraries in general. It is a problem with the JSF tag library specifically. After all, they could be written in a way that would preserve body content, could they not?
Full Threads Oldest First

Showing messages 1 through 3 of 3.

  • Attributing blame
    2004-06-10 12:29:51  BigBadaboom [View]

    Of course I meant to say "preserve the order of body content"
    • Attributing blame
      2004-06-10 13:18:39  Hans Bergsten | O'Reilly Author [View]

      I'm not blaming JSP. JSP is fine for what it does, but it was never intended to be used for the purpose it's used in JSF. That's the point: JSP together with JSF isn't working; by themselves, both technologies are fine.

      And no, you can't fix all ordering problems in the JSF tag handlers. Say you have this:

      <h:panelGroup>
      Some text
      <h:outputText value="Some other text" />
      Some more text
      </h:panelGroup>

      JSF components don't know anything about JSP (and they shouldn't) so the panel component can only render the content represented by child JSF components.

      The best the panelGroup tag handler can do is buffer its body and create Output components for the template text and add them as children of the Panel component it represents. But the JSP container/tag handler protocol doesn't include any mechanism to let the tag handler figure out that there are two sections of template text, with a JSF tag in between. Hence, the tag handler can't create one Output component per template text line; it can only create one Output component for all template text and add it as a child after the Output component created by the nested JSF tag. So, you still have an ordering problem.

      It's the same thing with the other problem areas I describe in the article. The JSF EG tried long and hard to overcome these issues, but there simply isn't a solution for them with JSP 1.2 (nor with JSP 2.0). Some may be possible to resolve with new revs of both specs, but it will be a kludge and I am convinced it's impossible to solve them all without totally messing up JSP and making it less useful for it's original purpose.
      • Attributing blame
        2004-06-21 12:22:24  BigBadaboom [View]

        But the JSP container/tag handler protocol doesn't include any mechanism to let the tag handler figure out that there are two sections of template text, with a JSF tag in between.


        That's not strictly true, I have created a couple of tag libraries that do this. The solution is for the outputText tag to write a marker into the body content of the panelGroup tag which gets checked for in panelGroup.doAfterTag(). It's not exactly elegant, but it works.