Pankaj Pank
Pankaj Pank

Reputation: 21

Richfaces is not defined in richfaces 4.0.0.jar nested jsp(struts) and Jsf

I am using JSF2.0 and I have the following RichFaces JAR files:

Facelets (XHTML) pages runs smoothly with <rich:xxx> tags. But when I embed <rich:xxx> tags in JSP pages, the following JavaScript error occues:

Richfaces not defined.

Why does it occur in JSP pages and not in Facelets pages?

Upvotes: 2

Views: 2167

Answers (1)

BalusC
BalusC

Reputation: 1108722

The RichFaces JavaScript files are automatically included when you use the JSF2 <h:head> tag in your view. You've apparently used a <head> tag instead of <h:head> tag in your JSP view which caused that the RichFaces JavaScript files are not automatically included anymore.

Fix it accordingly.

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE html>
<f:view contentType="text/html">
    <html lang="en">
        <h:head> <!-- Here, you should use <h:head> instead of <head> -->
            ...
        </h:head>
        <h:body> <!-- And preferably also <h:body> instead of <body> -->
            ...
        </h:body>
    </html>
</f:view>

Upvotes: 1

Related Questions