Akyna Akyna - 4 months ago 109
Ajax Question

Tag Library supports namespace: http://java.sun.com/jsf/core, but no tag was defined for name: ajax

Below page

<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<h:form>
<h:outputLabel id="outtxt" value="#{user.name}"/>
<h:inputText id="intxt" value="#{user.name}">
<f:ajax event="keyup" execute="intxt" render="outtxt"/>
</h:inputTtext>
</h:form>


Throws below error


Tag Library supports namespace: http://java.sun.com/jsf/core, but no tag was defined for name: ajax


How is this caused and how can I solve it?

Answer

The <f:ajax> is only available in Facelets tag library of JSF.

However, you're using JSP which is deprecated since JSF 2.0. All JSF 2.x development for JSP has stopped. All new JSF 2.x specific tags/attributes such as <f:ajax>, <h:head>, <h:link>, <h:button>, <h:inputFile>, <f:viewParam>, <f:viewAction>, etc are not available in JSP tag library of JSF. You need to migrate JSP to its successor Facelets in order to utilize the new JSF 2.x specific tags/attributes. See also below links for more detail about Facelets:

If you've found this JSP example in some JSF book/tutorial/resource, then it's likely a JSF 1.x targeted one. When learning JSF 2.x, make absolutely sure that you read a JSF 2.x targeted book/tutorial/resource. Our JSF wiki page is a good starting point.

Comments