This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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..
Sorry, perhaps my english language isn't too good.. Prepare for SCJP 6, Please God help me.. ☼
References : [Java.Boot] [JavaChamp] [JavaPrepare]
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:
Customer surveys are for companies who didn't pay proper attention to begin with.