Richfaces scripts / styles not loading
I have a simple scrollableDataTable in a jsf
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<!-- RichFaces tag library declaration -->
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<f:view>
<h:form>
<div id="contentvoll">
<div id="contenttabelle">
<rich:scrollableDataTable value="#{searchBean.searchList}" styleClass="fullTable" rowClasses="odd,even" var="elem" id="suchTable"
first="1" rows="50" rowKeyVar="activeRow" activeRowKey="#{searchBean.activeRowKey}" frozenColCount="1">
<rich:column>
<f:facet name="header">
&开发者_C百科lt;h:outputText value="Firmennummer"></h:outputText>
</f:facet>
<h:outputText value="#{elem.firmnr}"></h:outputText>
</rich:column>
<rich:column>
<f:facet name="header">
<h:outputText value="Firmenname"></h:outputText>
</f:facet>
<h:outputText value="#{elem.fname1}"></h:outputText>
</rich:column>
</rich:scrollableDataTable>
</div>
<div class="update"></div>
</div>
</h:form>
</f:view>
I think I'm doing something wrong because this produces me only a table which I can't scroll and where the cols are overlapping. Seems like the javascript which is needed isn't loaded. I include this into template
<script src="/portal/faces/rfRes/org/ajax4jsf/framework.pack.js" type="text/javascript"></script>
<script src="/portal/faces/rfRes/org/richfaces/ui.pack.js" type="text/javascript"></script>
My web.xml
<context-param>
<param-name>org.ajax4jsf.RESOURCE_URI_PREFIX</param-name>
<param-value>rfRes</param-value>
</context-param>
<filter>
<display-name>RichFaces Filter</display-name>
<filter-name>richfaces</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
<filter-mapping>
<filter-name>richfaces</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<!-- JSF configuration -->
<context-param>
<param-name>javax.faces.application.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.LoadStyleStrategy</param-name>
<param-value>NONE</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.LoadScriptStrategy</param-name>
<param-value>NONE</param-value>
</context-param>
<context-param>
<param-name>javax.portlet.faces.renderPolicy</param-name>
<param-value>NEVER_DELEGATE</param-value>
</context-param>
<!-- Faces Servlet -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup> 1 </load-on-startup>
</servlet>
<!-- Faces Servlet Mapping -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
Does anyone has faced the same problem?
I'd suggest using:
<context-param>
<param-name>org.richfaces.LoadStyleStrategy</param-name>
<param-value>ALL</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.LoadScriptStrategy</param-name>
<param-value>ALL</param-value>
</context-param>
This will load everything automatically.
However, if you don't want it (for some reason), you should use (instead of <script>
):
<a4j:loadScript src="resource:///org/ajax4jsf/framework.pack.js" />
(or <a4j:loadStyle />
for css)
Because it adds a .jsp / .jsf suffix, but you aren't supposed to use it that way in the common case.
精彩评论