JSF html命名空间不起作用 [英] JSF html namespace does not work

查看:81
本文介绍了JSF html命名空间不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我的Facelets代码:

I'm working with a maven project that deploys a WAR archive to a project that deploys an EAR archive to a JBoss server.



Here is my Facelets code:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC 
    "-//W3C//DTD XHTML 1.0 Strict//EN" 
    "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core">
<h:head>
    <title>title</title>
</h:head>
<h:form>

    <h:body>
        <input type="button" value="babap"></input>
        <h1>Ueberschrift</h1>

        <p>paragraph</p>

        <h:outputText value="outputText" />

        text at bottom
    </h:body>
</h:form>
</html>

除了< h:outputtext> 。它只是不显示在网站上。这是如何造成的,我该如何解决它?

Everything seems to work except for <h:outputtext>. it simply doesn't show up on the website. How is this caused and how can I solve it?

推荐答案


除了h:outputtext。它只是不显示在网站上。

请求网址(您在浏览器中看到的网址地址栏)匹配 FacesServlet 的URL模式?如果不是,那么它将不会被调用,因此所有的JSF作品都不会被执行。

Did the request URL (the URL as you see in browser's address bar) match the URL pattern of the FacesServlet? If not, then it won't be invoked and thus all the JSF works just won't be performed.

您需要确保请求URL与URL匹配 FacesServlet 的模式。如果它映射到 *。jsf ,然后通过 /foo.jsf 而不是 /foo.xhtml 。或者,更好的方法是将 web.xml 中的 FacesServlet 的网址格式更改为 * .xhtml 。这样你就不用担心虚拟URL。

You need to make sure that the request URL matches the URL pattern of the FacesServlet. If it's mapped on *.jsf, then open the page by /foo.jsf instead of /foo.xhtml. Or, better, just change the URL pattern of the FacesServlet in web.xml to *.xhtml. This way you never need to worry about virtual URLs.

这篇关于JSF html命名空间不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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