h:outputScript not defined in library h

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-07 09:24:01

问题


I enetered this code

<h:outputScript name="jsf.js" library="javax.faces" target="head"/>

But my IDE says that <h:outputScript> tag is not defined in library h which I declared as below.

<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>

What's going on?


回答1:


The JSF 2.0 <h:head>, <h:body>, <h:outputScript>, <h:outputStylesheet>, <f:ajax> and all <ui:xxx> tags are not available when you use the ancient JSP as view technology. You should instead be using its successor Facelets, which is usually a XHTML file.

JSP has been deprecated as JSF view technology since 2009 already. Make sure you're reading up to date resources when learning JSF. Start at our JSF wiki page.

See also:

  • Java EE 6 tutorial - Introduction to Facelets
  • Why Facelets is preferred over JSP as the view definition language from JSF2.0 onwards?



回答2:


Make sure that your xml name space definitions are correct. To include JSF tag libs you normally need the following:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

   <!-- header and body of your page -->

</html>


来源:https://stackoverflow.com/questions/10443803/houtputscript-not-defined-in-library-h

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