File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Control the execution order in jsf Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Control the execution order in jsf" Watch "Control the execution order in jsf" New topic

Control the execution order in jsf

Ziyang Zhang
Ranch Hand

Joined: Jul 17, 2010
Posts: 47
Hi All,

I build a table with several rows. And put a commandlink in each row.

What I want is:


if the lick is clicked, an action binded to a method in the bean is fired, meanwhile the id of the row is passed as param, so some information could be retrieved from DB according to the id and then stored in the bean.


Then model panel(from RichFaces) can display the data I just retrieved from DB.

But the fact is that. Step1 does not execute before step 2. So if I clicked the link, data retrieved when the last time the link is clicked is displayed. So, data of the current row is not displayed, the data of last clicked row is displayed.

Could some body tell me if there any mechanism to control this?

Or could I realize my goal in other ways? Now I can only click the link, fire the action, get the data, and show the data in a new page, which is not good, I want to stay in the same page.

And for some reason, I can not get the data in advance when the table is built, I have to query DB to get it dynamically.

Thank you very much!!

Enjoy life!
Ziyang Zhang
Ranch Hand

Joined: Jul 17, 2010
Posts: 47
Got an answer!!!

This blog helped me. Although the solution in the blog did not work for me, I get a workable solution from the comments.

Here is a my piece of workable code. Ask me if you have any questions!!!

I agree. Here's the link:
subject: Control the execution order in jsf
jQuery in Action, 3rd edition