File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Facelets+JSF2.0 CommandLink action method not called

 
H Li
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 "#{customer.id}" to constant, action method still not called
5) Use tag c:forEach, still not working.


Any one has a idea?

Thanks


 
H Li
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 17616
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic