Forums Register Login

How to show Information Dialog?

+Pie Number of slices to send: Send
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..
+Pie Number of slices to send: Send
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:


a fool thinks himself to be wise, but a wise man knows himself to be a fool - shakespeare. foolish tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 6118 times.
Similar Threads
newbie null reference exception
JSF <h:commandButton action> not working
redirection from backbean
JSF action doesn't call bean method
problem JSF - datatable from DB
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 09:18:31.