[richfaces-issues] [JBoss JIRA] Created: (RF-2351) LoadStyleStrategy does not work in portlet/facelet environment.

Andreas Chlupacek (JIRA) jira-events at lists.jboss.org
Thu Feb 28 10:53:57 EST 2008


LoadStyleStrategy does not work in portlet/facelet environment.
---------------------------------------------------------------

                 Key: RF-2351
                 URL: http://jira.jboss.com/jira/browse/RF-2351
             Project: RichFaces
          Issue Type: Bug
    Affects Versions: 3.1.4, 3.1.3
         Environment: JBoss Portal 2.6.3-GA / JBoss [Trinity] 4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=200710221139)
Java version: 1.5.0_11,Sun Microsystems Inc.
Java VM: Java HotSpot(TM) Client VM 1.5.0_11-b03,Sun Microsystems Inc.
OS-System: Windows 2000 5.0,x86 
            Reporter: Andreas Chlupacek


A JSR-168 portlet project using RichFaces 3.1.3-GA and facelets was deployed on JBoss Portal 2.6.3. In the project's web.xml, the context-parameter org.richfaces.LoadStyleStrategy was specified. But regardless of the value assigned to this parameter (DEFAULT, NONE, or ALL), the generated markup always looks the same: The document will always contain references to the individual per-component xcss resources. Neither NONE nor ALL seem to make a difference. This behaviour was observed with 3.1.3-GA as well as with 3.1.4-GA and 3.1.4-SR1.


Steps to reproduce:
===================
Set up a portlet application with the following artefacts:


web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
	<!-- These parameters prevent loading separate style/javascript for each Richfaces components
		It must be used together with a portal-wide configuration, see jboss-portlet.xml -->
	<context-param>
		<param-name>org.richfaces.LoadStyleStrategy</param-name>
		<param-value>NONE</param-value>
	</context-param> 
	<context-param>
		<param-name>org.ajax4jsf.COMPRESS_STYLE</param-name>
		<param-value>false</param-value>
	</context-param>	
	<context-param>
		<param-name>org.richfaces.LoadScriptStrategy</param-name>
		<param-value>NONE</param-value>
	</context-param> 
	<context-param>
		<param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
		<param-value>false</param-value>
	</context-param>
	<context-param>
		<param-name>org.ajax4jsf.RESOURCE_URI_PREFIX</param-name>
		<param-value>rfRes</param-value>
	</context-param>
	<!-- This is optional parameters for a facelets based application -->
	<context-param>
		<param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
		<param-value>
			org.ajax4jsf.portlet.application.FaceletPortletViewHandler
		</param-value>
	</context-param>
	<context-param>
		<param-name>javax.portlet.faces.renderPolicy</param-name>
		<param-value>ALWAYS_DELEGATE</param-value>
	</context-param>
	<context-param>
		<param-name>facelets.DEVELOPMENT</param-name>
		<param-value>true</param-value>
	</context-param>
	<context-param>
		<param-name>facelets.SKIP_COMMENTS</param-name>
		<param-value>true</param-value>
	</context-param>
	<context-param>
		<param-name>facelets.VIEW_MAPPINGS</param-name>
		<param-value>*.xhtml</param-value>
	</context-param>
	<context-param>
		<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
		<param-value>server</param-value>
	</context-param>
	<filter>
		<display-name>Ajax4jsf Filter</display-name>
		<filter-name>ajax4jsf</filter-name>
		<filter-class>org.ajax4jsf.Filter</filter-class>
	</filter>
	<filter-mapping>
		<filter-name>ajax4jsf</filter-name>
		<servlet-name>FacesServlet</servlet-name>
		<dispatcher>FORWARD</dispatcher>
		<dispatcher>REQUEST</dispatcher>
		<dispatcher>INCLUDE</dispatcher>
	</filter-mapping>
	<servlet>
		<servlet-name>FacesServlet</servlet-name>
		<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<servlet-mapping>
		<servlet-name>FacesServlet</servlet-name>
		<url-pattern>/faces/*</url-pattern>
	</servlet-mapping>
	<mime-mapping>
		<extension>svg</extension>
		<mime-type>image/svg+xml</mime-type>
	</mime-mapping>
	<login-config>
		<auth-method>BASIC</auth-method>
	</login-config>
</web-app>



faces-config.xml:
<?xml version="1.0"?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
                              "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
 <!-- Richfaces configuration -->
 <application>
  <view-handler>org.ajax4jsf.portlet.application.PortletViewHandler</view-handler>
  <state-manager>org.ajax4jsf.portlet.application.PortalStateManager</state-manager>
 </application>
 <factory>
  <faces-context-factory>org.ajax4jsf.portlet.context.FacesContextFactoryImpl</faces-context-factory>
 </factory>
</faces-config>


portlet.xml:
<portlet-app version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/portlet"
  xmlns="http://java.sun.com/xml/ns/portlet">
  <portlet>
    <portlet-name>richFacesPortlet</portlet-name>
    <portlet-class>javax.portlet.faces.GenericFacesPortlet</portlet-class>
    <init-param>
      <name>javax.portlet.faces.defaultViewId.view</name>
      <value>/richFacesPortlet/view.xhtml</value>
    </init-param>
    <expiration-cache>-0</expiration-cache>
    <portlet-info>
       <title>RichFacesPortlet</title>
    </portlet-info>
    <supports>
      <mime-type>text/html</mime-type>
      <portlet-mode>VIEW</portlet-mode>
    </supports>
  </portlet>  
</portlet-app>


jboss-portlet.xml:
<?xml version="1.0"?>
<!DOCTYPE portlet-app PUBLIC
   "-//JBoss Portal//DTD JBoss Portlet 2.6//EN"
   "http://www.jboss.org/portal/dtd/jboss-portlet_2_6.dtd">
<portlet-app>
	<portlet>
		<portlet-name>richFacesPortlet</portlet-name>
		<header-content>
           <script src="/faces/rfRes/org/ajax4jsf/framework.pack.js" type="text/javascript" ></script>
           <script src="/faces/rfRes/org/richfaces/ui.pack.js" type="text/javascript" ></script>
           <link rel="stylesheet" type="text/css" href="/css/myStyles.css" /> 
		</header-content>
	</portlet>
</portlet-app>


portlet-instances.xml:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<deployments>	
	<deployment>
		<instance>
			<instance-id>RichFacesPortletInstance</instance-id>
			<portlet-ref>richFacesPortlet</portlet-ref>
		</instance>
	</deployment>		
</deployments>


portlet-object.xml:
<?xml version="1.0" encoding="UTF-8"?>
<deployments>		
	<deployment>
		<if-exists>overwrite</if-exists>
		<parent-ref>default.default</parent-ref>
		<window>
			<window-name>richFacesPortletWindow</window-name>
			<instance-ref>RichFacesPortletInstance</instance-ref>
			<default>true</default>
			<region>center</region>
			<height>0</height>
		</window>
	</deployment>
</deployments>


view.xhtml:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<a4j:portlet xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html"
	xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich">

	<h:form>
		<h:panelGrid columns="1" border="1" >
			<!-- <h:inputText value="#{bean.text}">
				<a4j:support event="onkeyup" reRender="text,input" />
			</h:inputText>
			<h:outputText id="text" value="#{bean.text}" />
			<h:commandButton action="#{bean.click}" value="Click"></h:commandButton>
			<h:outputText id="counter" value="Click count: #{bean.counter}" /> -->
			<rich:panel headerClass="panelHead" bodyClass="panelBody">
				<f:facet name="header">Test Panel with header and body Class</f:facet>
			                
			    Lorem ipsum dolor sit amet, <br />
			    consetetur sadipscing elitr, <br />
			    sed diam nonumy eirmod tempor <br />
			    invidunt ut labore et dolore <br />
			    magna aliquyam erat, sed diam <br />
			    voluptua. <br />
				<br />

			</rich:panel>
			
		</h:panelGrid>
	</h:form>

</a4j:portlet>


/css/myStyles.css:
.panelHead {
	padding: 0px;
	background-color: #FF0000;
	background-image: none;
	font-weight: bold;
	font-size: 12px;
	color: #FFFFFF;
	vertical-align: center;
}

.panelBody {
	padding: 0px;
	font-size: 18px;
}



Observed behaviour:
===================
The setting for LoadStyleStrategy seems to be ignored in a portlet/facelet application. Neither NONE nor ALL make a difference for the references to the CSS files. They are always referenced per-component, in the middle of the document's markup. This leads to the effect that custom CSS classes (specified for example via headerClass or styleClass attributes) are partially overwritten by RichFaces' component-specific styles. In the example above, none of the attributes of .panelHead or .paneyBody will ever have any effect since they are superseded by .dr-pnl-h, .dr-pnl-b, .panelBody and .dr-pnl.

This happens regardless of the RichFaces version or combination of RichFaces and Portletbridge JARs (3.1.3-GA, 3.1.4-GA and 3.1.4-SR1). Any combination of LoadStyleStrategy and COMPRESS_STYLE attributes was tested.


Expected behaviour:
===================
The attributes ALL and NONE should cause loading of no stylesheets at all or a single consolidated CSS, respectively.



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the richfaces-issues mailing list