Practical RichFaces book
Project Templates
Download project templates for Tomcat 5.5 and Tomcat 6: rcbook-templates.zip
Source code
Import as Eclipse project. I used JBoss Tools to build the application. You can also import as JSF Project (File/Import/Other/JSF Project)
Chapter 4
Wizard (using a4j:include and a4j:keepAlive tags)
Chapter 7
Data iteration components
Errata
Page 10:
As of this writing, JBoss Tools GA version isn’t yet available.
should be:
As of this writing, JBoss Tools 3.x GA version isn’t yet available.
Page 43:
Bottom of page 43:
h:inputText has incorrect attribute ajaxSingle:
<h:inputText id="code" ajaxSingle="true" value="#{userBean.promotionalCode}"/>should be:
<h:inputText id="code" value="#{userBean.promotionalCode}"/>Page 60:
Just above the image:
If reRender points to the second column and ajaxKeys contains the first row, then only the
colored data cell will be updated.
should say:
If reRender points to the second column and ajaxKeys contains the second row, then only the
colored data cell will be updated.
Page 67-68:
Navigation rules and image on pages 67-68 use forward as the outcome to navigate to the next page. The code sections for page step1.xhtml and step2.xhtml mistakenly use step2 and step2 as outcomes for buttons. You can either correct the navigation rules or outcomes in pages.
Page 146:
rich:datascroller tag is not closed.
should be:
<rich:datascroller for="statesTable" maxPages="4" selectedStyle="font-weight:bold" align="left"/>



AFAIK think the book does not include anything on how to create new/modify existing richfaces controls… Am I wrong?
If I am right… are there any plans on writing a book about component creation/modification?
That’s correct, the book doesn’t cover how to create/modify RichFaces components. It’s an advanced topic and can be covered in a book by itself. If time permits, maybe I will write a Pro RichFaces book that would cover more advanced topics, use Seam and show how to create/modify rich components.
When I specified the web.xml file, Eclipse said this : “File is not recognized as web descriptor file.”
How can I run the source code ?
Just tested, it workd for me. Which JBoss Tools version are you using?
JBoss tools 3.0.0 Alpha1
Try the just released GA of JBoss Tools.
Hi Max – Bought your book and congrats, excellent piece of work. I need a quick hint though on running the Wizard example in the Seam environment.
I copied the code verbatim but when I click on the Next link to bring me from page 1 to page 2 in the wizard, I get kicked out of the modal dialog and page 2 appears in the full browser window.
I’m guessing Seam is interfering here – any ideas ?
Thanks,
I don’t know what could be causing this without looking at page source. Check that you are not doing a redirect. Also, if you are using Seam, I wouldn’t use a4j:keepAlive but the more powerful Seam conversation.
No redirects. Environment is Seam 2.1.1, JBT 3.0.0, Eclipse 3.4.2. Here’s the page src in wizard order, namespaces and backing bean stripped. To reiterate, clicking on Next link in phase1.xhtml kicks me out of the modal panel and back into the full browser window. Thanks !.
Jump off page for wizard;
Launch Wizard
phase1.xhtml;
<h:form
phase2.xhtml;
<h:form
pages.xml
Let’s take this offline as code is not showing. Email me at max at exadel dot com
Hi Max,
Some weeks ago I discovered RichFaces and since then I have written some applications for my final project.
Now I am writting a sort of editor in which I need to add some components dynamically. In the editor I have a palette in the right side.
I´m capable of adding dynamically a new TabPanel in the left side when I click an option in the palette through a binding.
Is it posible to change the options in the palette (change the palette indeed) if now I click in the new TabPanel I have added? Since the TabPanel is added dynamically I have no idea how can I do this.
May you suggest my anything ?
Thanks,
Fran
Just use binding the same way. Your component will be restored (on postback) and passed into the setter.
Hi Max,
I was looking into the -tag and tried to create something like you’ve did (the app with the US states through ajax-calls).
I’ve just downloaded the sourcecode for the book of this site, but when using it in combination with the codetranscript from the book, the example isn’t working.
I’ve noticed some differences between the back-end and the front-end:
- in the xhtml you are refering to stateView, while in the zip there’s a stateBean.java
- the inputText in the xhtml is has as value #{stateView.input}, but that property doesn’t exist in the stateBean class.
- the statesList contains all available states. By calling stateView.suggest, you would expect the resulting list is shown in the xhtml. I just see all states, instead of the ones you would expect.
Am I missing something here?
Thanks,
Jack
I most likely used different names. Is the example from book source code working?
Hi Max,
Can’t say, because the book only shows the jsf/xhtml part. (chapter 4, page 63).
I was curious how you’ve did the back-end stuff, so I tried adding the back-end stuff myself. It would help if you could provide the corrected stateBean.java compared to the example from the book. So I can check whether or not I did a good job
Thanks,
Jack
Updated practical-richfaces.zip source to include this example.
Thanks Max!
See you later today during your RichFaces UI Components showcase.
Grtz,
Jack
I can’t seem to download “practical-richfaces.zip”? It points me to a page with the name on it. Clicking on the name opens a preview window.
Grtz,
J
Uploaded new file.
Hi
You had mentioned in one of ur presentation that you would give a code to download the “Practial Myfaces” ebook for free.
Can you email the link where i can get that please
Guru
You most likely misunderstood. I was only giving free PDF copies back in December 2008.
Max,
I have purchased your book and was looking for Cross Frame Menu Example. But i could not find out. Can you Please give some idea how to create Drop Down using Richfaces ? I tried to create one but menu items are not visible in other frame.
You can find an example here: http://livedemo.exadel.com/richfaces-demo/richfaces/dropDownMenu.jsf
Hi Max
I have fully functional RichFaces 3.3.0.GA enabled Portlets (JSR 286) which work in JBoss Portal 2.7.1 with JBoss Bridge 1.0.0.CR2. How ever deploying it under WebSphere Portal 6.1 running on WebSphere AS 6.1 it throws an exception that the Filter resources are not properly instalized in the web.xml:
Rendering View[/myportlet/view.xhtml]
javax.faces.FacesException: Resources framework is not initialised, check web.xml for Filter configuration
at org.ajax4jsf.resource.ResourceBuilderImpl.getWebXml(ResourceBuilderImpl.java:116)
at org.ajax4jsf.resource.ResourceBuilderImpl.getUri(ResourceBuilderImpl.java:323)
at org.jboss.portletbridge.richfaces.PortalResourceBuilder.getUri(PortalResourceBuilder.java:29)
I traced the org.ajax4jsf.resource.ResourceBuilderImpl.getWebXm method and on the place where this exception is thrown, it appears that the WebXml Object is null.
I read here: http://mail-archives.apache.org/mod_mbox/myfaces-users/200807.mbox/
that the Ajax4Jsf Filter is not running in WebSphere.
Depending on the Filter Mapping I used in the web.xml, I either get the Portlet to render the Standart JSF with out RichFaces components or I get the above message.
When the Portlet renders the Standard JSF, I looked in to the source code of the page and I see the rich faces panels etc. printed out but the components are not loaded or rendered.
I noticed that the Java Script links are possibly not loading, cause they look in my opinion not correct, such as: http://localhost:8080/wps/myappcontextpath/rfResorg/richfaces/renderkit/html/scripts/utils.js
I think that the part /rfResorg/ should be more like: /rfRes/org/
I found this bug in the jboss jira: https://jira.jboss.org/jira/browse/RF-7189?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
It seems it could be related to my problem.
Do you have any suggestions or advise please.
Greetings goce
That seems like class-loading problem, the same thing as Liferay on Tomcat 6 issue. Websphere runs filter and FacesServlet with different contexts.
We’ve tried to run RichFaces on IBM Websphere (not portal ), and it seems to work only with ‘DISPATCHER’ style filter mapping.
I am facing some problem deploying the application on glassfish no ajax functionality is working, is there any known issue in glassfish with richfaces please let me know
Not aware of any issues. Check the log or console for any errors.
Hi Max,
First of all I congratulate you for the cooperation that always are willing to provide.
I have the following problem with a modalPanel:
When this field is required and it is sending the form of presents mansajes
validation required, and when I close the modal reopen it shows me the values
loaded earlier.
Any help that you give me the pudeas thank in advance.
thanks max,
i have read the log and i find this error
Unable to set request character encoding to UTF-8 from context /practical-richfaces, because request parameters have already been read, or ServletRequest.getReader() has already been called|#
could you help?
Post your web.xml file via http://tinypaste.com
it is the same as the one i get it from your book source code and you can find iut here
http://tinypaste.com/29060
I don’t know what the problem..you might get this error if there is another filter that sets the chat set. Try Glassfish or RichFaces forums.
Hi Max,
I have a a4j: CommandButton showing a modalPanel the modalPanel has some required fields when I save not fill some fields required me their messages, to all normal here, I close the modal panel (X) and I kept re-open the previous values in fields.
I tried to attribute the process but I have problems when modalpanel have selectonemenu.
the CommandButton that opens modalPanel, he points to a backing bean method, where I instanciating object pointing to the fields
form of modalpanel.
Any help I can give you
I’m not sure I understand the question, but the modal panel opens in the browser only (client side). You might have to reRender to clear or get new values.
I use reRender in a4j: CommandButton that opens modalpanel, but the problem is when the fields required in modalpanel not pass validation, and then re-open modalPanel maintains the values previously typed
You can call an action to clear the values before showing the modal panel.
the code is as follows:
page1.xhtml
….
page2.xhtml
………
…….
I use a actionLitener the CommandButton that opens the modal to clean the bean that points to the values of the modal fields and the problem persists
I’m more than happy to answer general and concept questions, but I not able to answer code specific questions here. Try RichFaces forum or Exadel offers professional RichFaces support.
ok, thanks max
Hi Max,
has some articles on using rich:fileupload?
Thanks
Not yet, but there is a great example here: http://livedemo.exadel.com/richfaces-demo/richfaces/fileUpload.jsf
How can I get the richfaces 4 jars. thanks.Mail to me
Hi Max!
I alway use RichFaces library with my projects. It’s cool library! But my internet connection sometimes very slow. Is the any way to download source files or (.ear,.war) of RichFaces Live Demo? Just to deploy locally on JBoss AS. Thanks!
@Eldar: You can download the .war here: http://www.jboss.org/index.html?module=bb&op=viewtopic&t=104575
Hi
I am trying to install the rcbook-templates.zip file into the Eclipse plug-in directory but I have no org.jboss.tools.common.projecttemplates_X.X.X sub-directory. I have Eclipse 3.5.1 installed?
thanks
Did you install JBoss Tools?
Thanks for the reply. I have just installed JBoss Tools and I still have no org.jboss.tools.common.projecttemplates_X.X.X sub-directory?
There is one if you download http://jboss.org/tools/download/dev.html (All plug-ins) but it appears to be an update. I haven’t tried the template with JBoss Tools 3.1.x so I would recommend 3.0.x with Eclipse 3.4.2.
Thanks for your help, that combination worked for me. I now have problems with Tomcat, but I’ll figure it out!
Hi Max,
I downloaded source code, but there was chapter 4 and chapter 7. Other chapters aren’t included. I’m working on ch6, and I didn’t see “toolBarBean” bean. Can you update it (or only source of beans, xhtml files and image etc. files, can you send me) ?
thanks
I didn’t include chapter 6 because the managed beans are very simple. It’s almost easier to just copy&paste and create your own beans. But, if you still want to have the code, I’ll post it in a few days.
Is it possible to define a custom event for rich:column filterEvent?
for example: filterEvent=”whenEnterKeyPressed(event)”
@Bob Yes, you can do that. Just write a JavaScript function to listen to that event.
Hello,
Is there any code downloads for the examples in the books? I can’t seem to find it anywhere. I am trying to have different context menus on a tree based on the value and level of the nodes. The example on pg 194-195 seems to be clase, but the code is not really explained and does not show all the code as for the simpleTreeBean. I also want to ensure the when context menu items ivoke actions that it does not refresh the page. Can you help?
thanks
Well, I’m back again and seem to have figured out the code on 194-195. However, there seems to be a cahnge in the way the listeners work in the latest release. The ActionListener executes before the setPropertyActionListener. I saw some suggestions for work arounds but have not be able to get any to work. Any suggestions with an example designed for an idiot would be greatly appreciated.
thanks
@dave: Use action instead of actionListener.
Chapter 4, page 60
Does not work for richfaces 3.3 (it only works for 3.2)
The actionparam is not called before the actionListen, so updateRow is null, resulting in a NullpointerException in repeatBean.decrease.
@Ruud – use action instead of actionListener.
Hello
I get the following error:
suggestionAction=”#{statesSuggestionBean.suggest}”: java.lang.NullPointerException
The @PostConstruct does not seem to work. It works when the code is run during class initialisation.
I am using JBOSS 5.1.0GA unchanged and the libraries in the web archive as in the above downloadable zip file (practical-richfaces\web\WEB-INF\lib), without the duplicates with the version numbers (eg. commons-beanutils-1.7.0.jar):
common-annotations.jar
commons-beanutils.jar
commons-collections.jar
commons-digester.jar
commons-logging.jar
jsf-facelets.jar
jsf-tlds.jar
jstl.jar
richfaces-api-3.2.2.GA.jar
richfaces-impl-3.2.2.GA.jar
richfaces-ui-3.2.2.GA.jar
standard.jar
Google could not help me, does somebody have any clues ?
@Jaap: I can’t say what the problem with just this information. Yes, @PostConstruct is called only once after the bean has been crated. Check on what line you get the NullPointerException.
Hi
I am having issue in running richfaces application in Websphere 6.1.0.15. Do you have any sample applicaiton with the right richfaces jars(version)?
Please let me know ASAP.
Regards
Prasanna
@Prasanna: no, I don’t have any examples on Websphere. Check requirements in developers guide. If still not working, post a question on RichFaces forum.
Hi max,
i was using a Wizard in my app already, but i am experiencing a Problem with using Validators. For example: in step2 i have a , i cant proceed backward, because the validator triggers.
Now my application has a form with multiple req. fields. I use the Attr. immediate=”true” to prevent the validator to trigger. But now da values filld arent stored, because the setters arent triggered too.
I was searching around now for a while, but i didnt find any solution for this Problem. Even the livedemo() loses values on a back-Action in the middle Step.
Perhapse you can help me out?!
Tanks in advance
Best Regards
Andi
hello
@Andi: using immediate on input components doesn’t skip validation, it moves the conversion/validation to phase 2 (Apply Request Values). The values are not stored because if you have conversion or validation errors, Update Model phase is not executed. That’s how JSF works, nothing to do with RichFaces.