I was snooping around in the Articles on Writing section of the Science Fiction and Fantasy Writers of America (SFWA), and stumbled across this essay written in 1998 by James Van Pelt entitled PERSEVERANCE, PUBLISHING AND THE URGE TO WRITE.
His essay does a great job conveying the mindset needed to keep writing despite despair and discouragement. Here’s an excerpt:
In fact because publishing is so unlikely, it gives me the freedom to write anything I please. I recently sold a story to Realms of Fantasy that was a writing experiment on my part. I didn’t think it was commercial at all, but I liked writing it.
I sent it out because I have this second hobby, submitting the work. Marketing feels exactly like fishing to me. Most of the time, nothing happens, and I begin to believe there are no fish in those enticing holes I’m tossing my lure into. Then, every great while, I get a strike.
The rest of Van Pelt’s short essay, as well as lots more advice about writing by various authors, can be found at the SFWA website.