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

    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

  2. max

    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.

  3. Bob

    Is it possible to define a custom event for rich:column filterEvent?

    for example: filterEvent=”whenEnterKeyPressed(event)”

  4. dave

    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

  5. dave

    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

  6. Ruud

    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.

  7. Jaap

    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 ?

  8. max

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

  9. Prasanna

    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

  10. max

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

  11. Andi

    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

  12. max

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

  13. Ken Kham

    Hi Max,
    I tried out your wizard modal panel as in the book and it works beautifully. But when I tried it out in a our real project which uses facelets, the second appears in the full browser window. This is exactly the same problem experienced by Paul Keogh in an earlier post. At the time, you suggest to him to take it offline. Did you figure out the cause of the problem? Please advise. Thanks

  14. Ken Kham

    Hi Max,
    Thanks for the reply. No I am not using Seam.
    I better explain more on the constraints of the existing project where I try to incorporate the wizard so that you can help me with suggestions on how to get around the problem.
    The “main” page where I put the “Launch wizard” link is already within a form due to existing constraints so I have to remove the h:form in the include page1.xhtml, things would not be visible otherwise. The h:form tag remains on pag2.xhtml. Otherwise things are very much as in your book example.Thanks

  15. max

    @Ken: difficult to say what the problem. Make sure you have only one form and you use a4j:commandLink or a4j:commandButton to navigate. If you want, create a small project where this problem is reproduced and upload it via http://drop.io. I’ll take a look at it.

  16. Yingxue

    Hi Max,

    I bought the book and downloaded the source code.

    But the source code is not complete.

    I am not a good typer.
    Can you send me all the code pieces in the text? For example,
    Chapter 4, Using
    Using

    Thanks,
    Yingxue

  17. Yingxue

    Max, is it possible to send me all the source code mentioned in the book, including all the chapters? Even better, complete code to run all the components and examples.

  18. max

    @Yingxue: I didn’t include all the examples as most of them are very short and easy to write yourself (a good way to learn). I will update the source code with chapter for this week.

  19. Yingxue

    Max, thanks. Your idea “good way to learn” is great for students. For programmers at work we do not have much time to learn. For a new technology, first we get ideas what it does then find out a demo to see functionality. When we decide to use it, we download example codes and make them run.

    Waiting for your code update. Hope it can contain as much as possible. You may know my email address.

    Thanks again!

  20. Yingxue

    I spent a few hours and could not make “use modal panel as wizard” in chapter 6 work.

    It is really a headache because the example code missing in the download.

    Max, can you really help?

  21. Yingxue

    Max, can you just put your code in the download to save typing? Even if it is not working it is OK. As the author of the book you should have all the code somewhere. Please!

  22. max

    I will add chapter 10 code. As for chapter 11 (Skin), there is really not much to add. Just drop any 2-3 components on a page and change the skins or create a custom one.

  23. Yingxue

    Thanks, Max.

    I am trying to make Tree Drag and Drop example SimpleTreeDndBean.java.
    It needs a property file simple-tree-data-dnd.properties.
    Can you tell me where to download this file?

  24. AG

    Hello Max,

    Im really new talking about jsf, richfaces, and the complementary frameworks like spring and hibernate, i need to learn how this frameworks works together, especially richfaces and hibernate but i cant find where can i get some basic classes or read about this.

    For example i can get the values from an array but typing the data in that array directly, but i cant show the data in a rich datatable when this data are fill it in the array or list whit hibernate.

    Ps: Thx for ur time and i hope ur answer soon as posible :P.
    Ps2: Sorry, my english its a little bad.

  25. max

    @AG: there are many resources on the Internet to help you started with JSF, Google (or search engine of your choice) is your best friend. As for RichFaces, I would view the components demo, read the developers guide. I have numerous posts on how to use various RichFaces tags on my blog via this link and tag (richfaces-howto): http://mkblog.exadel.com/tag/richfaces-howto/

  26. Ashok Singh

    Hi Max,

    In reference to Practical Richfaces, Chapter 6:
    I am running with Tomcat 6.0.29, Richfaces 3.1.4.GA. I am trying out the ‘Creating a Wizard Using ‘ example, but the starting page is throwing the exception ‘rich:component not found ..”. I do not see the rich:component tag in the Richfaces tag library or in the available documentation.

    I would appreciate if you could shed some light, and perhaps give out a workaround with another Richfaces tag.

    Thanks,

    Ashok

  27. Ashok Singh

    Thanks Max, I managed to run the Chapter 6 Wizard example under Tomcat howver it fails when run as a Portlet (using richfaces 3.3.3-final, portletbridge 2.0.0CR1).
    It appears that the in the start.xhtml throws the error “The requested resource (/dwRichFacesDemo1Wiz-portlet/modalPanel/#”) is not available.

    I am sending you an email with PDF showing the error; and the Portlet WAR file. Any suggestions that you can offer in havng your Wizard example work as a Portlet are greatly appreciated.

  28. ishaan

    Hi Max,

    I have requirement for dropdown with editable text showing default value.
    The richfaces4 have rich:select with manual input.
    Pls can you send the code with example including setting and retrieving value in jsf action bean

Leave a Reply