从 JSF 页面中删除附加标头
我使用以下代码编写了一个 .xhtml
页面:
<html>
<head>
<title>Test</title>
</head>
<body>
<p>P</p>
</body>
</html>
我正在新窗口中使用 JavaScript 打开此页面。
不幸的是,它显示为
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<div id="">
<html>
<head>
<title>Test</title>
</head>
<body>
<p>P</p>
</body>
</html>
</div>
</html>
“这当然是无效的 HTML”。如何删除那些附加的标签?首先为什么要创建它们?
我正在使用 JSF 1.2、Facelets、Portlet API 2.0 和 JBoss PortletBridge。
I've written an .xhtml
page with the following code:
<html>
<head>
<title>Test</title>
</head>
<body>
<p>P</p>
</body>
</html>
I'm opening this page with JavaScript in a new window.
Unfortunately it's displayed as
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<div id="">
<html>
<head>
<title>Test</title>
</head>
<body>
<p>P</p>
</body>
</html>
</div>
</html>
This of course is invalid HTML. How can I remove those appended tags? And why are they created in the first place?
I'm using JSF 1.2, Facelets, the Portlet API 2.0 and JBoss PortletBridge.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试使用 jsf head 和 body 组件:
Try using the jsf head and body components:
您应该使用带有组件的模板,然后在您的页面中使用
例子
模板
和 .xhtml 页面
You should use a template with components and then in your page
example
template
and the a .xhtml page
我现在已经编写了一个
HttpServlet
的弹出窗口可以规避这个问题。由于转发到的文件以*.jsp
结尾,因此它不受FacesServlet
并且没有奇怪的标头被附加。I've now written a
HttpServlet
for the pop-up to circumvent this problem. Since the file to which it's forwarding is ending with*.jsp
, it's not affected by theFacesServlet
and no strange header gets appended.