1

I am trying to integrate the ICEFaces ACE component library in my project. I've the following view:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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">
<head>

<h:outputStylesheet library="org.icefaces.component.skins"
    name="rime.css" />

<f:loadBundle basename="resources.application" var="msg" />
<title>
        <h:outputText value="#{msg.templateTitle}" />
</title>
</head>

<body>
    <div id="content">
        <h:form>
            <ace:dataTable var="user" value="#{userBean.users}"
                paginator="true" rows="50" selectionMode="multiple">
                <ace:column headerText="users">
                    <ace:row>#{user}</ace:row>
                </ace:column>
            </ace:dataTable>
        </h:form>
    </div>

</body>

</html>

Unfortunately apparently there is no JavaScript / CSS loaded, so the components are not displayed properly. Moreover, the server logs this:

ICEfaces configured for view /index.xhtml but h:head and h:body components are required

Is this related?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Paul
  • 547
  • 4
  • 13
  • 30
  • 1
    Why don't you show code in [MCVE](http://stackoverflow.com/help/mcve) flavor? When one would copy'n'paste'n'run the code unmodified in order to try to reproduce your problem on a blank playground project, the runtime would complain that the `template.xhtml` is missing. – BalusC Jan 07 '15 at 10:54
  • Good point, I adapted my question. Hope it is more understandable now... – Paul Jan 07 '15 at 11:57
  • Didn't you see a warning in server logs which says like *"One or more resources has the target of 'head' but not 'head' component has been defined within the view"*? – BalusC Jan 07 '15 at 11:59
  • I can see a warning saying "ICEfaces configured for view /index.xhtml but h:head and h:body components are required". Is this what you mean? – Paul Jan 07 '15 at 12:04

1 Answers1

1

You need to use JSF <h:head> and <h:body> components instead of plain HTML <head> and <body>. This way JSF and any JSF component library will be able to programmatically auto-include CSS/JS resources in there.

E.g.

<!DOCTYPE html>
<html lang="en"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core">
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
>
    <f:loadBundle basename="resources.application" var="msg" />

    <h:head>
        <title>#{msg.templateTitle}</title>
    </h:head>

    <h:body>
        ...
    </h:body>
</html>

Note that this way you also don't need that <h:outputStylesheet> anymore.

See also:


Unrelated to the concrete problem, you'd better declare resources.application as <resource-bundle> in faces-config.xml, so that you don't need to repeat it over all views. Also note that you don't necessarily need <h:outputText> over all place. The <head> and all of above also indicates that you're learning JSF based on a JSF 1.x targeted tutorial instead of a 2.x targeted one. Make sure that you're using the right resources to learn.

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555