[英]How to make facelets conform to XHTML 1.0 Transitional?
Why can't facelets XHTML files be valid XHTML 1.0 Transitional files? 为什么facelets XHTML文件不能有效XHTML 1.0 Transitional文件? If I submit a facelet file in an xml validator (eg w3c validator) it shows an error on the first tag defined in one of the taglibs.
如果我在xml验证器(例如w3c验证器)中提交facelet文件,则会在其中一个taglib中定义的第一个标签上显示错误。
Example 1: 例1:
If I submit the following file to the validator, it shows no error, validation goes fine because no taglib tags appear in the document (one jsf taglib is defined though). 如果我将以下文件提交给验证器,它没有显示错误,验证正常,因为文档中没有出现taglib标签(虽然定义了一个jsf taglib)。
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html">
<head>
<title></title>
</head>
<body>
</body>
</html>
Example 2: 例2:
Now I just inserted the h:head and h:body tags from the xmlns:h namespace but this causes errors in the validation. 现在我只是从xmlns:h命名空间插入h:head和h:body标签,但这会导致验证错误。
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<title></title>
</h:head>
<h:body>
</h:body>
</html>
Certainly I'm missing something fundamental here, but I still can't figure out what. 当然我在这里缺少一些基本的东西,但我仍然无法弄清楚是什么。
This is my first question here at SO so please point out any errors, thank you! 这是我在SO的第一个问题所以请指出任何错误,谢谢!
If you check the Lifecycle of a Facelets Application you can see that your view is rendered to the client. 如果您检查Facelets应用程序的生命周期,您可以看到您的视图呈现给客户端。 This will transform tags like
<h:head>
replacing them with their xhtml equivalent eg <head>
. 这将转换像
<h:head>
这样的标签,用它们的xhtml等效替换它们,例如<head>
。 If you want templates that are XHTML valid you may want to try with the jsfc attribute but it has its drawbacks. 如果你想要XHTML有效的模板,你可能想尝试使用jsfc属性,但它有它的缺点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.