wood burning stoves*
The moose likes JSF and the fly likes trouble with saving drafts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "trouble with saving drafts" Watch "trouble with saving drafts" New topic

trouble with saving drafts

Juliano Sott

Joined: Jul 13, 2009
Posts: 3
I need to save a draft of a document which name is give by the user, but before I save the draft I need to check if a draft with the same name already exists. If it exists, I need to ask the user if he want to override the draft.
I want to go by this way: I call a managedBean method to check if a draft with the same name already exists, then I show a alert to the user using javascript and finally I need to save the draft calling another method on the managedBean. Someone have an Idea how I do that? Or have another approach to do that?

Thanks for listening
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15961

If you want to show an alert via JavaScript, you might as well just go whole hog and do your check using AJAX.

Since this can be pretty messy in JSF (not that I think that raw AJAX is all that pretty anyway), I recommend you consider using one of the AJAX-supportive component packages such as RichFaces. It can handle that sort of problem with a few tag options and probably less than 10 lines of user-written JavaScript code.

Customer surveys are for companies who didn't pay proper attention to begin with.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: trouble with saving drafts
Similar Threads
Troubles with rich:modalPanel
Simple Accept / Reject Dialog refuses to work
Hibernate 2: check if table exists and get the name of the table out of the class
Rewriting Records into RecordStore
Correctly implementing save with JFileChooser