使用f:view覆盖默认的contentType-缺点? [英] Using f:view to override default contentType - cons?

查看:171
本文介绍了使用f:view覆盖默认的contentType-缺点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在JSF 2.0应用程序中使用了许多jQuery插件,但并非所有插件都生成可以成功通过webkit浏览器严格XHTML检查的HTML.因此,解决方案是实际进入插件的代码并对其进行更正,以使其生成有效的HTML,这本身是一个非常耗时的过程,或者将生成的HTML的内容包装在<f:view contentType="text/html">中.后者非常简单,并且可以正常工作. 使用<f:view>以这种方式覆盖内容类型有什么弊端吗?

I use a lot of jQuery plugins in my JSF 2.0 application and not all of them generate HTML which can successfully pass through the strict XHTML checks of webkit browsers. So the solution is to actually get into the plugin's code and correct it so that it generates a valid HTML, which is a very time consuming process in itself, or, wrap the contents of generated HTML in <f:view contentType="text/html">. The latter is quite straight forward and it works. Are there any cons of using <f:view> to override the content type in such a manner?

推荐答案

JSF默认使用

JSF defaults to the closest media type in the Accept header as is been sent by the webbrowser. If the URL matches *.xhtml, then it will usually end up to be application/xhtml+xml in some browsers and text/html in other browsers. You can without any problems force it to be text/html, most browsers treat XHTML as HTML anyway. Forcing to application/xhtml+xml is however a different story: MSIE doesn't support it in any way.

  • IE's XHTML Compatibility
  • Internet Explorer wants to download the webpage of GuessNumber example application instead of displaying it
  • Is it possible to use JSF+Facelets with HTML 4/5?

这篇关于使用f:view覆盖默认的contentType-缺点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆