Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

trouble with saving drafts

 
Juliano Sott
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18214
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic