my dog learned polymorphism*
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


JavaRanch » Java Forums » Java » JSF
Bookmark "trouble with saving drafts" Watch "trouble with saving drafts" New topic
Author

trouble with saving drafts

Juliano Sott
Greenhorn

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: 16103
    
  21

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.
 
GeeCON Prague 2014
 
subject: trouble with saving drafts