The problem is the following in details. I tried to implement a CSS style component named @Style, similar to the one in
It uses a nested writer in the Shell component to allow wrapped @Style components to contribute CSS files. The Shell and a wrapped Body are rendered in the following order:
1. a nested writer is created
2. the Shell's body (including the Body component) is rendered to the nested writer
3. <html>, <head>, </head> written
4. the nested writer is closed, so its content is committed to the "real" writer (the "real" writer is the one which was passed to Shell.renderComponent() when the Shell component has begun to render)
5. </hml> is written
At (2), in Body.java at line 187
is called, so PageRenderSupportImpl.writeInitializationScript(IMarkupWriter) is called. The problem is here because in PageRenderSupportImpl.java at line 252:
This means that the method PageRenderSupportImpl.writeInitializationScript() does not use its "writer" parameter, so the initialization scripts are written to the "real" writer instead of the nested one created at (1). This results in pages rendered incorrectly like
... some initialization scripts like Form registration...
I hope this helps.