aspose file tools
The moose likes JSF and the fly likes Actionlistener-Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Actionlistener-Problem" Watch "Actionlistener-Problem" New topic


Jens Weber

Joined: Jun 07, 2009
Posts: 1
Hey guys!
I want to design a dialog-popup (e.g. "Question..... please choose: Yes, No") , which I can call from anywhere within my project.
As i dont want to implent a new dialog for every case, i tried to design a function which gets "title", "message", "action" and "actionlistener" as parameters.

I used action="#{sessioninfo.destination}" in the past. Now I tried to write an ActionEvent-Method which returns something like #{sessioninfo.fetchDestinationActionEvent}. But this doesnt work.

The only thing I could do now would be to check the given actionlistener-method "by hand".
I mean something like this:

..but I think this is quite ugly and i'd have to know all the actionmethods, which might be called.

Is there any way to change- or set the actionListener-method of a h:commandButton at runtime?
I found a method "setActionListener()", but I didn't get it to work and it is marked as deprecated.

Do you have an idea to get around this problem?

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16540

I discussed something like the the other day, which was the usefulness of a "confirm" action button tag. Which, as far as I know, no one has yet implemented, but things are slow today, so....

Your first issue is that since Actions are server-side, but confirmations are client-side, you're either going to have to pop over to a confirmation page or implement an AJAX function.

In either of the above 2 events, you'd probably best be served by having a backing been in request scope that can be filled with the question and receives the answer. I don't think an actionListener is necessarily going to help here.

Customer surveys are for companies who didn't pay proper attention to begin with.
It is sorta covered in the JavaRanch Style Guide.
subject: Actionlistener-Problem