• 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 ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Display a Popup instead of an error-message at conversionError

Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,

i am pretty new to JSF and i am trying to display a formular which has a date-field to be filled by the user.

In my JSF-Page i am iterating over a list objects A, which has 3 String fields and 1 Date field.

When the Submit-Button is pressed, a red error-message appears on the screen. Instead I would like to display a popup with an errormessage when the user presses the submit-Button and the date-conversion fails.

Is there a way to achieve this?
Thank you in advance
Saloon Keeper
Posts: 27708
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
Welcome to the JavaRanch, Michael!

Straight JSF doesn't have any sort of support for popup windows or dialogs. The closest that you could get would be a link with a "target" attribute, but that wouldn't work when an input fails validation.

One of the prime virtues of JSF, however, is that it does provide better support for validation error handling than most platforms. Just not as popups.

Basically, out of the box you can either collect all the messages for the page and display them in one place using the "h:messages" element or you can tag the individual controls with messages. Like so:

BTW, avoid using Listeners when something simpler and more POJO will suffice. You don't need a "buttonAction" listener here, just a simple action method.

Among my pet peeves in JSF are use of HTML tags instead of JSF tags and use of ui:repeat for tabular data, so I've taken some liberties here.
I am a man of mystery. Mostly because of this tiny ad:
a bit of art, as a gift, that will fit in a stocking
    Bookmark Topic Watch Topic
  • New Topic