Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Mik Cantrell
Problems Getting the SImplest RichFaces Select to Work
September 4, 2012 9:08 PM
Answer

Mik Cantrell

Rank: New Member

Posts: 3

Join Date: August 28, 2012

Recent Posts

I'm using Liferay 6.1 + Tomcat 7 on MySQL. Please forgive me if this has been posted before. I have not been able to find anything that seems like it would help me.

I'm using RichFaces 4.2.2Final.

I'm just starting so I'm just trying to get the simplest rich:select to work from their show case and I can't get it to work. Been working on it for 3 days. I would appreciate any help or direction. I have tried using backing bean that returns values. When I do, the bean returns values but they are all printed under the select box.

the only errors I see are about missing resources. Not sure how to fix this nor if it's the primary issue.

ERRORS:
------------------------------------
03:56:57,312 ERROR [MissingResourceImpl:78] Resource handler=[com.liferay.faces
bridge.application.ResourceHandlerOuterImpl@2e80a4] was unable to create a reso
rce for resourceName=[inputBase.js] libraryName=[org.richfaces.images] contentT
pe=
03:56:57,348 ERROR [MissingResourceImpl:78] Resource handler=[com.liferay.faces
bridge.application.ResourceHandlerOuterImpl@2e80a4] was unable to create a reso
rce for resourceName=[popup.js] libraryName=[org.richfaces.images] contentType=
null]
03:56:57,403 ERROR [MissingResourceImpl:78] Resource handler=[com.liferay.faces
bridge.application.ResourceHandlerOuterImpl@2e80a4] was unable to create a reso
rce for resourceName=[list.js] libraryName=[org.richfaces.images] contentType=[
ull]
03:56:57,432 ERROR [MissingResourceImpl:78] Resource handler=[com.liferay.faces
bridge.application.ResourceHandlerOuterImpl@2e80a4] was unable to create a reso
rce for resourceName=[popupList.js] libraryName=[org.richfaces.images] contentT
pe=
03:56:57,466 ERROR [MissingResourceImpl:78] Resource handler=[com.liferay.faces
bridge.application.ResourceHandlerOuterImpl@2e80a4] was unable to create a reso
rce for resourceName=[select.js] libraryName=[org.richfaces.images] contentType

-----------------------------

Here is the xhtml page and as you can see it's about as simple as it can get. What I'm getting is just the drop down on my portlet with no values contained at all.
----------------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">

<rich:panel>
<f:facet name="header" value="This example shows a select component that behaves basically the same as the standard:">
<h:outputText value="Simple select"></h:outputText>
</f:facet>
<h:form>
<rich:panel>
<rich:select >
<f:selectItem itemValue="0" itemLabel="Option 1" />
<f:selectItem itemValue="1" itemLabel="Option 2" />
<f:selectItem itemValue="2" itemLabel="Option 3" />
<f:selectItem itemValue="3" itemLabel="Option 4" />
<f:selectItem itemValue="4" itemLabel="Option 5" />
</rich:select>
</rich:panel>
</h:form>
</rich:panel>
</ui:composition>
---------------------------------------------------

Here is my web xml

<?xml version="1.0"?>

<web-app
version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
>
<context-param>
<param-name>org.richfaces.skin</param-name>
<param-value>deepMarine</param-value>
</context-param>


<context-param>
<param-name>com.sun.faces.expressionFactory</param-name>
<param-value>org.jboss.el.ExpressionFactoryImpl</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>

<context-param>
<param-name>javax.faces.FACELETS_LIBRARIES</param-name>
<param-value>/WEB-INF/tomahawk.taglib.xml</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<context-param>
<param-name>org.richfaces.resourceMapping.enabled</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.enableControlSkinning</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.enableControlSkinningClasses</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.skin</param-name>
<param-value>classic</param-value>
</context-param>
</web-app>

I really appreciate any help or direction.

Mik
---------------------------------------------------------------------------
Neil Griffin
RE: Problems Getting the SImplest RichFaces Select to Work
September 5, 2012 1:57 PM
Answer

Neil Griffin

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2251

Join Date: July 26, 2005

Recent Posts

Hi Mik,

I would recommend that you look at the richfaces4-portlet portlet demo. You might want to compare your WEB-INF/web.xml file.

I added the following markup to the richfaces4-portlet views/portletViewMode.xhtml file and it worked OK:

 1<rich:panel>
 2<f:facet name="header" value="This example shows a select component that behaves basically the same as the standard:">
 3<h:outputText value="Simple select"></h:outputText>
 4</f:facet>
 5<h:form>
 6<rich:panel>
 7<rich:select >
 8<f:selectItem itemValue="0" itemLabel="Option 1" />
 9<f:selectItem itemValue="1" itemLabel="Option 2" />
10<f:selectItem itemValue="2" itemLabel="Option 3" />
11<f:selectItem itemValue="3" itemLabel="Option 4" />
12<f:selectItem itemValue="4" itemLabel="Option 5" />
13</rich:select>
14</rich:panel>
15</h:form>
16</rich:panel>
Mik Cantrell
RE: Problems Getting the SImplest RichFaces Select to Work
September 8, 2012 5:16 PM
Answer

Mik Cantrell

Rank: New Member

Posts: 3

Join Date: August 28, 2012

Recent Posts

Alright so I was able to get the RF Components to show up and seem to be working but now I have another issue. The simple Select has the correct values in the drop down and they look correct but when I choose one then the value shown in the select box has font sooo small it just looks like a small line. Please see attached picture and help if you can.

Thanks,
Mik
Attachment

Attachments: lray.png (31.3k)
Mik Cantrell
RE: Problems Getting the SImplest RichFaces Select to Work
September 10, 2012 2:01 PM
Answer

Mik Cantrell

Rank: New Member

Posts: 3

Join Date: August 28, 2012

Recent Posts

Just wanted to give the steps to reproduce this small font issue with rich faces.

1 - Using Eclipse Helios with Liferay Plugin
2- import Richfaces 4 Demo Project war
3 - Place the sample drop code into the view portlet page.
4 - pick any value from dropdown and then you should see the small font issue.

Thanks,
Mik
Neil Griffin
RE: Problems Getting the SImplest RichFaces Select to Work
September 11, 2012 9:31 AM
Answer

Neil Griffin

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2251

Join Date: July 26, 2005

Recent Posts

Thanks -- I was able to reproduce the problem following your instructions.

Using FireBug, I found that the Liferay theme is overriding the CSS from the RichFaces skin. Specifically, the following CSS from portal-web/docroot/html/themes/_styled/css/forms.css is causing the font-size to be 1em instead of 11px as instructed by the RichFaces theme:

1@mixin input-field-default {
2    background-image: url(../images/forms/input_shadow.png);
3    background-repeat: no-repeat;
4    border: 1px solid;
5    border-color: #BFBFBF #DEDEDE #DEDEDE #BFBFBF;
6    font: 1em Arial, Helvetica, Verdana, sans-serif;
7    padding: 5px 1px;
8}


There are three ways that I can think of that can work around this problem:

1) Put the following in your XHTML:

1<style type="text/css">
2.rf-sel-inp {font-size: 11px !important;}
3</style>


2) Create a new Liferay theme and inside of custom.css, add the following:

1.rf-sel-inp {font-size: 11px;}


3) Using a Liferay Hook Plugin, override the portal-web/docroot/html/common/themes/top_head.jsp so that the following line happens earlier in the JSP:

1<link class="lfr-css-file" href="<%= HtmlUtil.escape(PortalUtil.getStaticResourceURL(request, themeDisplay.getPathThemeCss() + "/main.css")) %>" rel="stylesheet" type="text/css" />


Each approach has its benefits/drawbacks, but I would probably implement #2