元数据组件需要嵌套在f

元数据组件需要嵌套在f

本文介绍了元数据组件需要嵌套在f:metadata标记内.建议:将必要的组件包含在< f:metadata>中.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我经历了不同的来源,例如:

I went through different sources like:

http://docs.oracle.com/javaee/7/javaserverfaces/2.2/vdldocs/facelets/f/metadata.html

这似乎是在jsf 2.2.1中已解决的问题,当我尝试使用该功能时,我遇到的问题是,以下是我的配置:

and it seems to be issue has been fixed in jsf 2.2.1, where as When I tried to use, I am facing issue, below are my configurations:

template.xhtml:

template.xhtml:

<!DOCTYPE html>
<html lang="#{languageBean.language}"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://xmlns.jcp.org/jsf/core"
    xmlns:h="http://xmlns.jcp.org/jsf/html"
    xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
    xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
    xmlns:fn="http://xmlns.jcp.org/jsp/jstl/functions"
    xmlns:p="http://primefaces.org/ui" xmlns:o="http://omnifaces.org/ui"
    xmlns:of="http://omnifaces.org/functions">
<!-- Enables CTRL+SHIFT+D for activating Facelets debug window -->
<ui:debug />
<f:view locale="#{languageBean.language}" encoding="UTF-8" contentType="text/html">
<!-- Client templates can insert f:metadata here, and this will NOT show up in the showcase page source code -->
<ui:insert name="meta" />

<c:set var="contextPath" value="${pageContext.request.contextPath}"
    scope="application" />
<f:loadBundle var="messageResource" basename="MessageResource" />
<h:head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
    <meta http-equiv="X-UA-Compatible"
        content="EmulateIE8,IE=edge,chrome=1" />
    <meta http-equiv="pragma" content="no-cache" />
    <meta http-equiv="cache-control" content="no-cache" />
    <meta http-equiv="expires" content="0" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="Connect" />
    <meta name="keywords"
        content="timeline, 3d, css, css3, css-only, transitions, responsive, fluid" />
    <meta name="author" content="FriendsMirror" />
    <link rel="shortcut icon"
        href="#{request.contextPath}/Friendsmirror.ico" />
    <ui:insert name="js"/>
    <h:outputStylesheet library="css" name="common.css" />
    <h:outputStylesheet library="css" name="main.css" />
    <ui:insert name="css"/>

    <ui:insert name="onloadScript"/>
    <title><ui:insert name="title">#{messageResource['connect.main.title.main.title']}</ui:insert></title>
</h:head>
<h:body>
<ui:insert name="content" />
</h:body>
</f:view>
</html>

页面:

<ui:composition template="/WEB-INF/templates/discussion_layout.xhtml"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://xmlns.jcp.org/jsf/core"
    xmlns:h="http://xmlns.jcp.org/jsf/html"
    xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
    xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">

    <ui:define name="meta">
        <f:metadata>
            <f:viewParam name="sessionKey" value="#{discussionWrapperBean.sessionKey}" />
            <f:viewParam name="ref" value="#{discussionWrapperBean.ref}" />
            <f:viewParam name="pId" value="#{discussionWrapperBean.pId}" />
            <f:viewParam name="dId" value="#{discussionWrapperBean.discussionId}" />
            <f:viewParam name="dName" value="#{discussionWrapperBean.discussionName}" />
            <f:viewAction action="#{discussionWrapperBean.loadInitDiscussion}" onPostback="false" />
        </f:metadata>
    </ui:define>

    <ui:define name="title">
        <ui:fragment rendered="#{discussionWrapperBean.profileId != null}">
            #{discussionWrapperBean.userBean.firstName} #{discussionWrapperBean.userBean.lastName != null ? discussionWrapperBean.userBean.lastName: ''}#{discussionWrapperBean.pageTitleNotifications != null ? '(' : ''}#{discussionWrapperBean.pageTitleNotifications != null ? discussionWrapperBean.pageTitleNotifications : ''}#{discussionWrapperBean.pageTitleNotifications != null ? ')' : ''}
        </ui:fragment>
        <ui:fragment rendered="#{discussionWrapperBean.profileId == null}">
            #{messageResource['connect.discussion.title']}
        </ui:fragment>
    </ui:define>

    <ui:define name="content">

    </ui:define>

</ui:composition>

行家:

<jsf.version>2.2.1</jsf.version>

<dependency>
    <groupId>com.sun.faces</groupId>
    <artifactId>jsf-api</artifactId>
    <version>${jsf.version}</version>
    <scope>provided</scope>
</dependency>

<dependency>
    <groupId>com.sun.faces</groupId>
    <artifactId>jsf-impl</artifactId>
    <version>${jsf.version}</version>
    <scope>provided</scope>
</dependency>

在Ui中,我遇到如下问题:The metadata component needs to be nested within a f:metadata tag. Suggestion: enclose the necessary components within <f:metadata>

In Ui I am getting issue like:The metadata component needs to be nested within a f:metadata tag. Suggestion: enclose the necessary components within <f:metadata>

即使它没有调用<f:viewAction>

任何建议或帮助将不胜感激.

Any Suggestion or help will be appreciated.

我在部署过程中注意到的一件事:信息:初始化Mojarra 2.2.0(20130502-2118 https://svn.java.net/svn/mojarra~svn/tags/2.2.0@11930 )中的上下文/connectWAR

One thing I noticed during deployment:INFO: Initializing Mojarra 2.2.0 ( 20130502-2118 https://svn.java.net/svn/mojarra~svn/tags/2.2.0@11930) for context /connectWAR

即使我已经升级到2.2.1,我也不知道为什么这会告诉Mojarra 2.2.0

I am not sure why this is telling Mojarra 2.2.0, even though I have upgraded to 2.2.1

推荐答案

关于错误的UI警告,这是由Mojarra issue 2868 ,自2.2.1起已修复.

As to the false UI warning, this is caused by Mojarra issue 2868 and already fixed since 2.2.1.

关于<f:viewAction>仍不能在2.2.1上运行,自Java EE 7引入xmlns.jcp.org XML名称空间域以来,另一个Mojarra错误引起了此麻烦.在特定的Mojarra版本2.2.0和2.2.1中,未为JSF 2.0/2.1中不存在的所有新的JSF 2.2特定标记(例如<f:viewAction>)正确注册新的XML名称空间域.实际上,xmlns.jcp.org将在Mojarra 2.2.0/2.2.1中为您提供与JSF 2.1兼容的标签.这完全解释了为什么新的JSF 2.2 <f:viewAction>对您不起作用.

As to the <f:viewAction> still not working on 2.2.1, another Mojarra bug with the since Java EE 7 introduced xmlns.jcp.org XML namespace domain is causing this trouble. In specifically Mojarra versions 2.2.0 and 2.2.1 the new XML namespace domain is not properly registered for all new JSF 2.2 specific tags which didn't exist in JSF 2.0/2.1, such as <f:viewAction>. In effects, the xmlns.jcp.org will give you in Mojarra 2.2.0/2.2.1 only the JSF 2.1 compatible tags back. This totally explains why the new JSF 2.2 <f:viewAction> didn't work for you.

您有2个选择:

  1. 请改用旧的" java.sun.com XML名称空间域.新的特定于JSF 2.2的标签已在此处正确注册.

  1. Use the "old" java.sun.com XML namespace domain instead. The new JSF 2.2 specific tags are properly registered there.

至少升级到Mojarra 2.2.2.自该版本以来,该特殊错误已修复. Mojarra已经当前已经是2.2.4.

Upgrade to at least Mojarra 2.2.2. This peculiar bug is fixed since that version. Mojarra is currently already at 2.2.4.

这篇关于元数据组件需要嵌套在f:metadata标记内.建议:将必要的组件包含在&lt; f:metadata&gt;中.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 01:33