Menu

#724 Click on RichFaces <rich:panelMenuItem> does nothing

Latest SVN
closed
None
5
2012-10-21
2008-11-09
No

I'm using RichFaces' <rich:panelmenu><rich:panelmenuitem></rich:panelmenuitem></rich:panelmenu>

This is HtmlUnit 2.3/Neko 1.9.9

If I use HtmlUnit to click the menu item, then no AJAX request is sent to the server. I've used Firebug to make sure that I'm clicking on the correct target and I've tried clicking on several different targets but nothing kicks off the AJAX request.

I've added a new test, RichPanelMenuTest.java, to the
htmlunit-richfaces project. To run the test:
svn co http://anonsvn.jboss.org/repos/jsfunit/htmlunit-richfaces/
cd htmlunit-richfaces
mvn -Dtest=RichPanelMenuTest

The WAR file can be deployed to Tomcat 5.5 if you want to run it by hand.

Discussion

  • Ahmed Ashour

    Ahmed Ashour - 2008-11-09

    After putting richfaces-demo-3.2.2.GA.war in tomcat:

    INFO: Initializing Mojarra (1.2_09-b02-FCS) for context '/richfaces-demo-3.2.2.GA'
    Nov 10, 2008 1:38:36 AM org.apache.catalina.core.StandardContext start

    SEVERE: Error listenerStart
    Nov 10, 2008 1:38:36 AM org.apache.catalina.core.StandardContext start

    SEVERE: Context [/richfaces-demo-3.2.2.GA] startup failed due to previous errors
    log4j:WARN No appenders could be found for logger (org.directwebremoting.util.Logger).

     
  • Ahmed Ashour

    Ahmed Ashour - 2008-11-09

    Using Tomcat 5.5 (not 6), i am able to run the application.

    However, IE7 doesn't change the value :)

    • In IE7, clicking "Item 1" doesn't show "Item 1 selected", but it is changed when you go to "Tag Information" and click "Usage" again.

    For reference, elements used are "iconform:j_id261", "iconform:j_id262", "j_id316_lbl", "j_id256_lbl"

    • With HtmlUnit, there are two alerts "Form tabber:_form not found in document".

    So, fix your test, and we should fix HtmlUnit.

     
  • Stan Silvert

    Stan Silvert - 2008-11-10

    The application works fine for me in both IE7.0.6000.16757 and FF3.0.3. You have to wait a second or two after the click because the span is updated via AJAX request. This is with Tomcat 5.5.

    There is no element "iconform:j_whatever". I think that you didn't do an update and build from svn. If you did, you would see this xhtml file that overrides the default xhtml file from the original RichFaces demo: /htmlunit-richfaces/src/main/webapp/richfaces/panelMenu/examples/example.xhtml

     
  • Daniel Gredler

    Daniel Gredler - 2008-11-11

    @Ahmed: Are you still looking into this? If so, can you set yourself as the assignee?

     
  • Ahmed Ashour

    Ahmed Ashour - 2008-11-11

    Don't think I will look into it the very coming days.

     
  • Ahmed Ashour

    Ahmed Ashour - 2008-11-13

    I was using richfaces-demo-3.2.2.GA as used in the test case.

    But now when I build it from htmlunit-richfaces trunk, there is no panelMenu.jsf

    Please advise, I need to have working richfaces before tackling HtmlUnit area.

     
  • Stan Silvert

    Stan Silvert - 2008-11-13

    There is no panelMenu.jsf file. If you go to http://localhost:8080/htmlunit-richfaces/richfaces/panelMenu.jsf then you will see /richfaces/panelMenu.xhtml rendered using JavaServer Faces.

    The htmlunit-richfaces application is based on richfaces-demo-3.2.2.GA.war. This is a dependent war, but we override certain files and classes such as src/main/webapp/richfaces/panelMenu/examples/example.xhtml. For example.xhtml, I changed the file to add id attributes to many of the elements.

    So if you clean and build from the trunk of the htmlunit-richfaces application, then deploy the resulting WAR to Tomcat 5.5, you should be able to go to http://localhost:8080/htmlunit-richfaces/richfaces/panelMenu.jsf and see the page that isn't working with HtmlUnit.

     
  • Ahmed Ashour

    Ahmed Ashour - 2008-11-14

    Using latest SVN, it works perfectly.

    Steps used to reproduce:

    - Generate war from htmlunit-richfaces trunk
    - Deploy on tomcat 5.5
    - Run the test case in htmlunit-richfaces trunk (with changing the URL)
    
     
  • Stan Silvert

    Stan Silvert - 2008-11-14

    Try running

    mvn -Dtest=RichPanelMenuTest

    That will run the test against Jetty. It fails.

    How did you run the test against Tomcat 5.5? I was only using Tomcat 5.5 as a way to look at the application, not to run the RichPanelMenuTest.

     
  • Stan Silvert

    Stan Silvert - 2008-11-14

    Did you run RichPanelMenuTest?

     
  • Ahmed Ashour

    Ahmed Ashour - 2008-11-14

    Yes, running "mvn -Dtest=RichPanelMenuTest" will fail.

    The project has old HtmlUnit 2.3 dependency

    Steps used to reproduce:

    - Generate war from htmlunit-richfaces trunk
    - Deploy war on tomcat 5.5
    - Run the test case against htmlunit-richfaces trunk (with changing the
    

    URL to tomcat local URL)

    I believe we should have HtmlUnit snapshot in local maven repo specially for you :)

     
  • Stan Silvert

    Stan Silvert - 2008-11-14

    I changed it to HtmlUnit 2.4-SNAPSHOT. You can download the new pom. It still fails.

    What URL are you changing? You are changing something in my pom?

     
  • Ahmed Ashour

    Ahmed Ashour - 2008-11-14

    After updating the whole project, mvn gives error:

    Missing:

    1) net.sourceforge.htmlunit:htmlunit:jar:2.4-SNAPSHOT

    • I manually copy the 'test' java code and run it against latest HtmlUnit version, and change the URL inside that code to point to local tomcat.
     
  • Stan Silvert

    Stan Silvert - 2008-11-14

    That means you don't have HtmlUnit 2.4-SNAPSHOT in your local Maven repo.

    How can that be if you just built it?

    Did you guys change the groupId or artifactId?

    Are you no longer using 2.4-SNAPSHOT as the version?

     
  • Ahmed Ashour

    Ahmed Ashour - 2008-11-14

    :)

    I build it in eclipse, but don't 'install' it in local repository.

    Anyhow, even on 'mvn install', the 'RichPanelMenuTest' fails because:

    2008-11-14 04:07:25.718::WARN: Failed startup of context org.mortbay.jetty.weba
    pp.WebAppContext@eca36e{/htmlunit-richfaces,jar:file:/C:/use/eclipse/workspace/h
    tmlunit-richfaces/target/htmlunit-richfaces.war!/}
    javax.servlet.UnavailableException: org.ajax4jsf.Filter
    at org.mortbay.jetty.servlet.Holder.doStart(Holder.java:78)

    You can do the following:

    - Make the first line of testRichPanelMenu() wait for 10 minutes (Thread.sleep()
    - Run "mvn -Dtest=RichPanelMenuTest"
    - The test will pause for 10 minutes
    - During that time, try to use your real browser to go to http://localhost:8080/htmlunit-richfaces/richfaces/panelMenu.jsf
    - You will get 'Service Unavailable'
    

    Conclusion: the test fails because the web application didn't start, not because HtmlUnit has an issue.

     
  • Stan Silvert

    Stan Silvert - 2008-11-14

    I just did a svn update and rebuilt HtmlUnit to the very latest. I still get the failure.

     
  • Ahmed Ashour

    Ahmed Ashour - 2008-11-14

    My dear, let's forget HtmlUnit for a while.

    Can you follow these steps and advise:

     
  • Stan Silvert

    Stan Silvert - 2008-11-14

    I can clearly see that Jetty worked normally. Other tests also run without a problem.

    This is the test result:

    Test set: org.jboss.htmlunit.RichPanelMenuTest

    Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 8.285 sec <<< FAILURE!
    testRichPanelMenu(org.jboss.htmlunit.RichPanelMenuTest) Time elapsed: 8.266 sec <<< FAILURE!
    junit.framework.ComparisonFailure: expected:<item 1.1...=""> but was:<nothing...>
    at junit.framework.Assert.assertEquals(Assert.java:81)
    at junit.framework.Assert.assertEquals(Assert.java:87)
    at org.jboss.htmlunit.RichPanelMenuTest.testRichPanelMenu(RichPanelMenuTest.java:53)</nothing...></item>

    You would not get that far if Jetty wasn't running. Your conclusion is not valid, at least for when I run the test.

     
  • Stan Silvert

    Stan Silvert - 2008-11-14

    My Dear,

    I did what you asked with the sleep and the real browser. The application came up normally. :-)

     
  • Ahmed Ashour

    Ahmed Ashour - 2008-11-14

    I am able to see your error now. Deploying the web application on tomcat is correctly processed by HU, but not when run from the 'mvn' jetty.

    Sometimes I see see the RichFaces 3.2.2.GA is still used as shown in:
    [INFO] Expanding: C:\Documents and Settings\ahmed.ashour.m2\repository\org\jbos
    s\jsfunit\richfaces-demo\3.2.2.GA\richfaces-demo-3.2.2.GA.war into c:\use\eclips
    e\workspace\rich2\target\war\work\org.jboss.jsfunit\richfaces-demo

    • Can you please remove that dependency from SVN pom.xml
     
  • Stan Silvert

    Stan Silvert - 2008-11-14

    The plot thickens. I just changed my pom to run against Tomcat 5.5 instead of Jetty. It works under Tomcat 5.5. It fails under Jetty 6.

     
  • Stan Silvert

    Stan Silvert - 2008-11-14

    That's funny. We both came to the same conclusion and posted within 2 seconds of each other.

    I can't remove that dependency or there won't be much left in the WAR!

     
  • Stan Silvert

    Stan Silvert - 2008-11-14

    BTW, I changed the status back to open since it clearly fails under Jetty and we can't yet determine if it is a problem with Jetty or HtmlUnit.

     
  • Ahmed Ashour

    Ahmed Ashour - 2008-11-25

    Dear Stan,

    Do you notice that testing with Jetty and IE, gives inconsistent results? Sometimes it works, sometimes it gives error.

    Just retype the URL and test.

    Do you have any idea why?

     
  • Marc Guillemot

    Marc Guillemot - 2009-01-21

    There is a problem in the application (using jetty at least): when accessing the page for the first time, the post url of the XHR ends with ;jsessionid=... which causes the server to answer with 404. This occurs as well with HtmlUnit as with FF (with empty cache, no session cookie)
    => workaround: change the test to invoke the page twice before performing any action on it... or better, fix the app!

    => test pass for FF2, FF3, IE6 and IE7.

     

Log in to post a comment.

MongoDB Logo MongoDB