Hello,
I have a problem with content type of pages generated by MyFaces. I'm
struggling with proper "hiding" JavaScript in HTML or XML documents. My
issue is that MyFaces think (I debugged my application running on Tomcat
6.0.20), that resulting content type will be text/html, so generated
code looks like this:
<script type="text/javascript"><!--
something here
//--></script>
But Tomcat itself in HTTP headers returns content type as text/xml. In
that case code should look like:
<script type="text/javascript"><[CDATA[
something here
//]]></script>
My Firefox (3.0, but i tried that in Opera and Konqueror as well), as it
sees XML document, treats whole script block as comment, so no
JavaScript code is being defined. That's why, when I use commandLink I
get "oamSubmitForm is not defined" error.
While debugging Tomcat I also checked what contentType is being set in
ServletResponseWrapper, and it is text/xml. Whereas in MyFaces in
HtmlResponseWriterImpl contentType is always set to text/html.
Is there any way to force MyFaces to always assume contentType to be
text/xml? Where from Myfaces get this value? Can someone help? I'm
struggling with it two days already.
Best regards
Jacek Bilski