File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Problem with commandLink Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Problem with commandLink" Watch "Problem with commandLink" New topic

Problem with commandLink

Marc Kruze

Joined: Oct 28, 2010
Posts: 5

On a JSP page, I have a dataTable and a few buttons on top (not inside the dataTable). These buttons are commandLink(s); when the user clicks on one of them (form example) a pdf report opens in a new window (target=_blank).

The problem is that once the user clicks on the commandLink button to open the new report page and closes it, clicking on other components on the same (original) page also run the action from the commandLink button. For example, clicking on the next page button of a pagerDeluxe at the bottom of the page will not advance the dataTable to the next page but open the pdf report window again.

Has anyone encountered this behavior, and what was your solution?

Thank you!
Sai Hegde
security forum advocate
Ranch Hand

Joined: Oct 26, 2010
Posts: 204

Please post your code so that anyone on the forum could check for stuff that should have been written some other way.
Marc Kruze

Joined: Oct 28, 2010
Posts: 5
Hello Sai,

The solution to this problem can be found here:

Basically, if you are using sub-JSF 1.2, it's best to use a requestLink rather than a commandLink if you run into the problem described on this thread.
I agree. Here's the link:
subject: Problem with commandLink
It's not a secret anymore!