问题
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