• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Actionlistener-Problem

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic