• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF2.0 Ajax Issue

 
ashishlife bansal
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well
i'm work on one JSF application where i'm using Prime Faces 3.5 lib for UI layer .
i have one form , on left hand side of that i have tree based menu and on right hand side i have working area , where the respective pages will be displayed
The issue is i want a ajax request on tree node selection which displays the associated page on right hand side working area .

what all i know is like ..


the issue is
1) in <p:ajax> i never use ...when i use <f:ajax> an exception is thrown in javascript code that listener method is not found
2) if i change <f:ajax> event as click i'll give another JSF exception that non-supported event .
3) now my concern is all that i want to open some another page on the invocation of doStuff method which is actually not a action method which returns string outcome whereas this is just a event handler method which returns void and this new page will open in right hand side working area .

my handler in my bean is like


so now how to decide which page to open on particular node selection ..
or how can we render a new page response without using action method or faces-config file .




 
Tim Holloway
Bartender
Posts: 18415
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The p:ajax and f:ajax tags are evidently different. The f:ajax tag's listener has to either be a no-arguments (pojo) method returning void or a method with the following signature:


Actually, the Oracle docs say that the listener must match that signature and doesn't say anything about a no-arguments listener, but considering just how sloppy the JavaDocs for core Java are, I'm not sure I believe that.

So your PrimeFaces listener method won't match the f:ajax signature requirements and thus the EL reference to the listener and the listener itself won't pair up.

As for the other question:


is an example of an action where there is neither an action method nor a faces-config/annotation definition for the target.
 
K. Tsang
Bartender
Posts: 3610
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since the p:ajax method onNodeSelect() doesn't return anything, it is up to you to control what is display.

Suppose I have a tree on the left and 2 panels on the right. Clicking the node on the tree will determine which panel to show/hide.






If you are loading a page instead of using panels, you can use ConfigurableNavigationHandler to performNavigation() to the desired page. If same page then most likely you need some query (the stuff after the ?) to determine what is loaded.

Hope this helps.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!