File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Facelets+JSF2.0 CommandLink action method not called Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Badass: Making Users Awesome this week in the Game Development forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Facelets+JSF2.0 CommandLink action method not called" Watch "Facelets+JSF2.0 CommandLink action method not called" New topic

Facelets+JSF2.0 CommandLink action method not called

H Li

Joined: Mar 21, 2011
Posts: 2
After convert JSP+JSF1.2+javaEE5 to FaceLes+JSF2.0+EE6, the commandLink not work any more

The step flow is as following:
1) After user invokes one Bean's action method, a object of type List<Custome> is created & then put in the requestScope with a key "customers"
2) After that,the the page gets rendered(see code below).
3) Click the command link, the action="#{customerBean.viewCustomerAddress}" is not called
4) Change "#{}" to constant, action method still not called
5) Use tag c:forEach, still not working.

Any one has a idea?


H Li

Joined: Mar 21, 2011
Posts: 2
If the data object customers of List<Customer> is put into session scope, the commandLink will work.

it seems to me, facelets enforce that the view must be restored before the commandLink click takes effect.

It really ridiculous because the date is already there, why bather to get the data once more.on the other hand, JSP no such problem.

Any one has better idea how to get around this issue, since too much work to change my JSP+JSF1.2 APP

Thank you

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16535

It is a fundamental part of the JSF lifecycle that the first phase is the View Restore Phase, and that's the same with/without Facelets.

JSF iteration controls generally maintain a cursor to do their work, and the only way that the cursor can function properly is if the referenced datamodel is in a non-transient scope. For JSF1, that means Session Scope or higher. For JSF2, View Scope or higher.

Customer surveys are for companies who didn't pay proper attention to begin with.
I agree. Here's the link:
subject: Facelets+JSF2.0 CommandLink action method not called