Practical RichFaces 1st edition


practicalrichfaces-book-cover-small.gif

Project Templates

Download project templates for Tomcat 5.5 and Tomcat 6: rcbook-templates.zip

Source code

Import as Eclipse project:
1) File/Import/General/Existing Project into Workspace/
2) Check ‘Select archive file’ and click Browse…
3) Browser and select practical-richfaces.zip
4) Click Finish
5) Deploy the application to Tomcat.

I used JBoss Tools to build the application. You can also import as JSF Project (File/Import/Other/JSF Project)

practical-richfaces.zip
(updated: 2010-07-26)
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"/>
Posted in

96 comments

  1. luxspes

    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?

  2. max

    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.

  3. tsikpemoise

    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 ?

  4. paulkeogh

    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,

  5. max

    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.

  6. paulkeogh

    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

  7. Fran

    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

  8. Superflokky

    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

  9. Superflokky

    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

  10. jml

    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

  11. Guru

    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

  12. Pranav Shah

    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.

  13. goce

    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

  14. max

    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.

  15. Rami Hailat

    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

  16. Juan Buzón

    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.

  17. Rami Hailat

    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?

  18. max

    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.

  19. Jhon

    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

  20. max

    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.

  21. Jhon

    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

  22. Jhon

    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

  23. max

    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.

  24. Eldar

    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!

  25. Paul Meehan

    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

Leave a Reply