1

I'm in the process of migrating from jsf 1.1 (with richfaces 3.1.6) to 2.0 (with richfaces 4.3.4). I'm encountering some issues with richfaces 4.3.4 and couldn't quite be able to figure out. I've writen the following test.xhtml to better describe the issues that I'm having:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html 
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:t="http://myfaces.apache.org/tomahawk"
    xmlns:a4j="http://richfaces.org/a4j"
    xmlns:ui="http://java.sun.com/jsf/facelets">
    <h:head>
    <title>My Account - View Device(s)</title>
    <script type="text/javascript" src="redesign/scripts/jquery.js?v=1.7.2"></script>
    <script type="text/javascript" src="redesign/scripts/jquery.filter_input.js"></script>

    <script type="text/javascript">
        //<![CDATA[
        $(document).ready(function(){
            $('#testForm:\\numField').filter_input({regex:'[0-9]'});
        });
        //]]>

    </script>
    </h:head>

    <h:body>
        <h:form id="testForm">
            <h:outputText value="User ID: " /><h:inputText id="numField" value="#{testBean.userID}"/>
            <h:commandLink action="#{testBean.updateUserID}" value="myfaces CommandButton"/>
            <h:outputText value=" | " />
            <a4j:commandLink reRender="testForm" value="A4J Command Link" action="#{testBean.updateUserID }" /> 
        </h:form>
    </h:body>
</html>

Below are issues that I'm seeing with this test.xhtml:

1) When the "a4j:commandLink" tag is present in test.xhtml page, all jquery plugin failed to load (getting $("#testForm\:numField").filter_input is not a function error in this case). If I removed "a4j:commandLink" tag from this test.xhtml page, all plugin work fine.

2) I get this error when click on the "a4j:commandLink": javax.el.PropertyNotFoundException: Property 'updateUserID' not found on type com.arch.myaccount.jsf.TestBean. The "h:commandLink", which binds to the same action, works just fine.

I would appreciate any help.

HockChai Lim
  • 1,675
  • 2
  • 20
  • 30
  • not sure what I did. But the a4j:commandLink is now firing testBean.updateUserID method on click (I see it being fire in debug mode). But the screen is not being re-rendered. – HockChai Lim Oct 22 '13 at 22:00

1 Answers1

1

<a4j:commandLink reRender="testForm" value="A4J Command Link" action="#{testBean.updateUserID }" />

reRender has changed to render from RichFaces 3 -> RichFaces 4. Change that, then it will be "rerendered" just fine.

noone
  • 19,520
  • 5
  • 61
  • 76
  • Thanks you. That resolved my issue with richfaces not re-render the screen (Now, I remembered I've read about they rename it to match jsf2.) I'll be golden to move forward with this migration if I can resolve the jquery issue and my IDE not giving me the auto complete on richfaces and tomahawk tags. – HockChai Lim Oct 23 '13 at 18:30
  • I just realized that if I replace the with , the jquery works fine. It seems like the caused richfaces version of jquery to get loaded. I'm not sure what other effect it will have if I change it to use . – HockChai Lim Oct 23 '13 at 18:59
  • Don't include jQuery yourself. RichFaces automatically adds jQuery. And you have to use , if you use the necessary css and js files for your components will not be added. http://stackoverflow.com/questions/6028105/whats-the-difference-between-hhead-and-head-in-java-facelets – noone Oct 23 '13 at 19:42
  • Not include my own version of jQuery will only works if I move all the jQuery plugin and inline javascript to the section. Then I encountered problem with jquery-ui-1.7.3 not compatiable with richfaces version of jquery. sigh... This migration is getting a bit fustrating. I'm going to attempt to get rid of richfaces. All I use it for is ajax. I'll try to see if I can replace them with facelet ajax.... – HockChai Lim Oct 23 '13 at 21:20