Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Actionlistener-Problem

 
Jens Weber
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Greetings!
Jens
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18277
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic