首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >当使用JBoss6运行时而不是Tomcat7时,JSF组件不会呈现

当使用JBoss6运行时而不是Tomcat7时,JSF组件不会呈现
EN

Stack Overflow用户
提问于 2014-08-17 09:25:22
回答 1查看 59关注 0票数 0

我有一个简单的表单页面,如下所示:

代码语言:javascript
复制
<f:view contentType="text/html">
    <h:head>
        <title>Login Page</title>
    </h:head> 
    <body> 
        <h1>Java Learning Center</h1><hr id="horizontalLine"/>
        <h2><a>Account Login</a></h2>
        <h:outputText value="#{userBean.errorMessage}" style="color:red; text-size:20" />
        <h:form>
            <h:panelGrid>
                <h:outputText value="Username" />
                <h:inputText value="#{userBean.username}" id="username" required="true" />
                <h:message for="username" style="color:red; text-size:18"/>
                <h:outputText value="Password" />
                <h:inputSecret value="#{userBean.password}" id="password" required="true"/>
                <h:message for="password" style="color:red; text-size:18"/>
                <h:commandButton value="Login" action="#{userBean.verifyUser}" />
            </h:panelGrid>
        </h:form>
    </body>
</f:view> 
</html>

当我将其部署到Tomcat7时,将显示完整页面。但是,当我在JBoss6.1Runtime上部署时,没有显示与JSF的HTML标记库对应的表单元素。我只看到来自<h1><h2>等普通HTML元素的内容。

我在哪里犯了错?

EN

回答 1

Stack Overflow用户

发布于 2014-08-18 01:40:02

以前,我遇到了JSF2.0页面不能完全呈现的问题。然而,我在我的config-faces.xml中发现了我的愚蠢之处,我使用:

代码语言:javascript
复制
<faces-config
   xmlns="http://java.sun.com/xml/ns/javaee"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
      http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
   version="1.2">
   ...
</faces-config>

而不是:

代码语言:javascript
复制
    <faces-config
        xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
           http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
        version="2.0">
        ...
</faces-config> 

当不小心使用复制粘贴机制时出现的问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25345518

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档