Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to show Information Dialog?

 
Leonardo Carreira
Ranch Hand
Posts: 494
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends..

How to show Information Dialog in JSF?..
Example i want to show message dialog if the blank value occured or if the data input duplicate with data in database?..
and if the data already saved, then message dialog showed.. (like Desktop Application)..

is it possible in JSF?..

Here is my code :







Thanks in advance..
 
Tim Holloway
Saloon Keeper
Posts: 18303
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The web is a very different place than the desktop. But there are ways to fake it.

First, however, the best way to vet data is to do it according to the JSF architecture. If a field must not be empty, you can indicate that with the 'required="true"' attribute on the input control. You should also link an "h:message for=" element to that control so that the "item is required" message will display. In general you shouldn't validate data on the submit processor - I can tell you from experience it's an ungraceful thing to do.

In the case of checking for duplicate data, that's something that is more suited to the action process. The simplest thing to do in that case is to put a tag similar to the following on your view:


This will provide a place where the general messages (not tied to an individual control) can be displayed.

To add a message, you have to access the JSF context. Rather than fill my managed beans with a lot of awkward JSF code, I made a JSFUtils class and defined methods like this in it:


Using that, my action bean can do stuff like this:


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic