0
I am new to Primefaces and also to SWF. I have setup sauch page:

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">
<h:head>
    <title>Welcome to OTV_JSF_Spring_Hibernate_Project</title>
</h:head>
<h:body>
    <f:view>
        <h:form>
            <p:panel header="Keyboard Demo">
                <h:panelGrid columns="2" cellpadding="5">
                    <h:outputText value="USERs : "/>

                    <p:inputText id="name" value="#{sampleBean.jmeno}"/>
                    <p:selectOneRadio id="customRadio">
                        <f:selectItem itemLabel="Option 1" itemValue="1"/>
                        <f:selectItem itemLabel="Option 2" itemValue="2"/>
                        <f:selectItem itemLabel="Option 3" itemValue="3"/>
                    </p:selectOneRadio>

                    <h:outputText value="Basic QWERTY: "/>
                    <p:keyboard value="#{sampleBean.zadavanaHodnota}" layout="qwertyBasic"/>

                    <h3>Inline</h3>
                    <p:calendar size="21" value="#{sampleBean.datum}" id="inlineCal" mode="popup"
                                showOn="focus"/>

                    <p:commandButton action="pokracuj" value="Prechod na druhou stranku"/>
                    <p:dataTable rendered="false"/>

                </h:panelGrid>
            </p:panel>

            <p:dialog widgetVar="dialog" showEffect="fade" hideEffect="fade" header="Values">
                <h:panelGrid columns="2" id="display" cellpadding="5">
                    <h:outputText value="Value2:"/>
                    <h:outputText value="#{sampleBean.zadavanaHodnota}"/>
                </h:panelGrid>
            </p:dialog>


        </h:form>
    </f:view>
    <p:spinner/>
</h:body>

</html>

According to documentation it schould be OK, but when I run it on any AS (JBoss, WL), it outputs error in JS: Primefaces not defined. The start of generated page looks like this:

<html xmlns="http://www.w3.org/1999/xhtml"><head><link type="text/css" rel="stylesheet" href="/blank-web-1.0.0-SNAPSHOT/*/javax.faces.resource/theme.css?ln=primefaces-ui-lightness" /><link type="text/css" rel="stylesheet" href="/blank-web-1.0.0-SNAPSHOT/*/javax.faces.resource/primefaces.css?ln=primefaces" /><link type="text/css" rel="stylesheet" href="/blank-web-1.0.0-SNAPSHOT/*/javax.faces.resource/keyboard/keyboard.css?ln=primefaces" /><script type="text/javascript" src="/blank-web-1.0.0-SNAPSHOT/*/javax.faces.resource/jquery/jquery.js?ln=primefaces"></script><script type="text/javascript" src="/blank-web-1.0.0-SNAPSHOT/*/javax.faces.resource/primefaces.js?ln=primefaces"></script><script type="text/javascript" src="/blank-web-1.0.0-SNAPSHOT/*/javax.faces.resource/keyboard/keyboard.js?ln=primefaces"></script>

Problem is obvious - static resources - Primefaces.js, themes.js are not found. I have tried various configuration of SWF but I didnt succeed. For example my current conf regarding resource reading is this:

    <faces:resources />

    <!--<mvc:resources location="/, classpath:/META-INF/resources/, classpath:/META-INF/" order="1" mapping="/resources/**" />-->

    <mvc:resources mapping="/javax.faces.resource/**" location="/, classpath:/META-INF/resources/" />

I also tried resource servlet, but it didnt work neither. ResourceServlet org.springframework.js.resource.ResourceServlet 1 ResourceServlet /resources/*/

Thanks for any help.

JTask
  • 1
  • Is the rest of the web page rendered correctly? (Only valid HTML tags, no `h:*` or `p:*` stuff.) – siebz0r Aug 25 '12 at 09:27
  • Follow this link your problem will solve.... http://stackoverflow.com/questions/4825904/how-to-configure-spring-webflow-with-jsf-2-0/21233080#21233080 – Pravin Nov 04 '14 at 12:58

1 Answers1

1

Try it without mvc:resources tag. Also make sure Primefaces JAR gets deployed to your server.

rootkit
  • 2,165
  • 2
  • 29
  • 43