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:


should be:


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:


96 thoughts on “Practical RichFaces 1st edition

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

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

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

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

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

  23. 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!

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

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

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

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

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

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

  30. 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-richfaceswebWEB-INFlib), 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 ?

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

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

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

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

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

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

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

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

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

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

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

  42. 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!

  43. 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?

  44. 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!

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

  46. 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?

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

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

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

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

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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s