I want to correct indent before I send a JSF page to the user, because the indent is a little bit messy from JSF and it would be easier to do css stylig with nicier indent. So I want to redirect all output written by JSF rendering to a variable, parse it and then send it to the user. I tried to play a little with and thought that the <f:phaseListener> listening to RenderPhase might be the right way to go, but I don’t know how to do that concretely.
I want to correct indent before I send a JSF page to the user,
Share
A
Filteris the best tool for the job. APhaseListeneris only interesting if you’re interested in intercepting on the JSF lifecycle and/or the JSF component tree, not when you’re only interested in its generated HTML response. There exist theJTidyFilterwhich does exactly what you want. Just define it once inweb.xmland all the respone HTML will be prettified. All it basically does is wrapping theresponse.getOutputStream()to haul it through JTidy first.