0

エクリプスを使用しています。WEB-INF/lib フォルダーには、次の jar があります。

jstl-api-1.2.jar
jstl-impl-1.2.jar
myfaces-api-2.0.2.jar
myfaces-impl.2.0.2.jar

次の警告が表示されます

Multiple annotations found at this line:
    - Unknown tag (f:ajax).
    - Unknown tag (f:ajax).

.

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="f"  uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h"  uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>no</title>
</head>
<body>
<f:view>
    <h:form id="form1">
        <h:commandButton value="submit" type="submit" action="#{registrationBean.storeUserId}" >
             <f:ajax render="node1" />
        </h:commandButton>
        <br>
        <h:outputText id="node1" value="#{userIdBean.userId}" style="font-weight:bold" />
    </h:form>
</f:view>
</body>
</html>
4

1 に答える 1

1

<f:ajax>、古い JSP ビュー テクノロジではサポートされていません。後継の Facelets でのみサポートされています。

Facelets 構文に準拠するコードに名前を変更page.jspして書き直します。page.xhtml

<!DOCTYPE html>
<html lang="en"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
>
    <h:head>
        <title>no</title>
    </h:head>
    <h:body>
        <h:form id="form1">
            <h:commandButton value="submit" type="submit" action="#{registrationBean.storeUserId}" >
                 <f:ajax render="node1" />
            </h:commandButton>
            <br>
            <h:outputText id="node1" value="#{userIdBean.userId}" style="font-weight:bold" />
        </h:form>
    </h:body>
</html>

JSF 2.x を学習するときは、JSF 1.x のものではなく、JSF 2.x のリソース/チュートリアル/書籍を読んでいることを確認してください。

以下も参照してください。

于 2012-04-04T01:18:25.583 に答える