Richfaces脚本/样式未加载

时间:2009-12-29 07:49:26

标签: java jsp jsf richfaces

我在jsf中有一个简单的scrollableDataTable

<%@ 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">
       <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>

我认为我做错了什么,因为这只会让我产生一张我无法滚动的表格以及cols重叠的位置。好像没有加载所需的javascript。我把它包含在模板中

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

我的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>

有没有人遇到同样的问题?

1 个答案:

答案 0 :(得分:2)

我建议使用:

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

这将自动加载所有内容。

但是,如果你不想要它(出于某种原因),你应该使用(而不是<script>):

<a4j:loadScript src="resource:///org/ajax4jsf/framework.pack.js" />

(或<a4j:loadStyle />代表css)

因为它添加了一个.jsp / .jsf后缀,但在常见情况下你不应该这样使用它。