Rudi Steiner wrote:
I have still the problem with the generated XHTML from myFaces. I
reduced my app to a few basic mechanisms, but this basic mechanisms
must produce XHTML strict. To achieve this, i would like to wirte a
filter, which makes light modifications of the generated markup, just
to  satisfy the validator. For example, I would surround a hidden
field, generated by myFaces with a <div/>-Tag.

Could anyone please give me a hint how to achieve this. I tried it
with regular expressions but I think, it is not possible to work with
RE on OutputStreams.

You'd have to buffer the output and work on that - I think this is
what the MyFaces Extensions filter does too.

This is easily done in servlet filters, because each filter passes
the request and response objects down the chain, which are then
used by everything downstream of your filter. If instead of passing
on the same response that you received, you pass on a "decorated"
(enhanced) response, which overrides getOutputStream() and
getWriter(), you can give everyone else something which looks like
an OutputStream or PrintWriter but actually just captures everything
to a buffer. You can then manipulate the buffer as you wish.

Fixing MyFaces to generate compliant XHTML in the first place would
be a much better solution though, because otherwise you'll probably
have to update this filter every time MyFaces or Tomahawk are
updated.

MyFaces may have to generate HTML 4 to pass the TCK, but what
about a context-param setting to switch on strict XHTML markup
generation? It presumably wouldn't affect very many things anyway.


Jonathan.
--
.....................................................................
          Dr Jonathan Harley   .
                               .   Email: [EMAIL PROTECTED]
           Zac Parkplatz Ltd   .   Office Telephone: 024 7633 1375
           www.parkplatz.net   .   Mobile: 079 4116 0423

Reply via email to