I'm using eclipse. In the WEB-INF/lib folder I have the following jars.
jstl-api-1.2.jar
jstl-impl-1.2.jar
myfaces-api-2.0.2.jar
myfaces-impl.2.0.2.jar
I get the following warning
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>
The <f:ajax>
is not supported in the ancient JSP view technology. It's only supported in its successor Facelets.
Rename page.jsp
to page.xhtml
and rewrite the code conform Facelets syntax:
<!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>
When learning JSF 2.x, make sure that you're reading JSF 2.x resources/tutorials/books, not JSF 1.x ones.