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

感情迁移 提交于 2019-12-17 21:11:57

问题


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?


回答1:


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:

  • Our Facelets wiki page
  • How to include another XHTML in XHTML using JSF 2.0 Facelets?
  • Migrating from JSF 1.2 to JSF 2.0
  • Why Facelets is preferred over JSP as the view definition language from JSF2.0 onwards?

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.



来源:https://stackoverflow.com/questions/16653233/tag-library-supports-namespace-http-java-sun-com-jsf-core-but-no-tag-was-def

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!