Using f: lookup to override default contentType - cons?

I use a lot of jQuery plugins in my JSF 2.0 application, and not all of them generate HTML that can successfully go through stringent XHTML checks on webkit browsers. Thus, the solution is to actually enter the plugin code and fix it so that it generates valid HTML, which in itself is a very time-consuming process or wraps the content of the generated HTML in <f:view contentType="text/html"> . The latter is pretty straight forward and it works. Are there any drawbacks to using <f:view> to override the content type this way?

0
source share
1 answer

By default, JSF matches the closest media type in the Accept header that was sent by the web browser. If the URL matches *.xhtml , then it usually ends with application/xhtml+xml in some browsers and text/html in other browsers. You can make it be text/html without any problems, most browsers still treat XHTML as HTML. Forcing application/xhtml+xml , however, is different: MSIE does not support it in any way.

See also:

0
source

Source: https://habr.com/ru/post/1500335/


All Articles