I have a problem that I think is probably fairly common but I haven’t
seem to be able to come up with the magic combination of search terms to
find a solution (or it really isn’t that common). Here’s the deal…
Scenario: A system allows a user to enter in articles via a web-form.
The system provides a preview function; not a live preview, but a
preview on another page where they can see what the article will look
like when posted. The system follow s the share-nothing approach.
Challenge: The article object, from the user’s perspective, is not saved
until she clicks the SAVE button. If the user clicks the preview
button, however, the article object needs to be stashed somewhere so
that the preview page can pick it up. Then when the user returns to the
edit page from the preview, the article object again needs to be
retreived. How do you save the object without really saving it?
P.S. - Storing the object in the session is not an acceptable solution.
I’ve handled this case so far by saving the object, but with a status
(an attribute of the object) of NEW. Then when the user ACTUALLY saves
the object, I change the status to SAVED. This works, but is a bit
cumbersome as all of the code that deals with objects like this needs to
be aware of this status.
Any help would be appreciated.