A thick skin is needed when you're a writer. Rejection is almost always part of the equation as you work on getting your writing represented, published, edited, read .... all of the above. And even if everything were to go smoothly there's still bound to be some rejection. Not all readers will like your book and you will hear/read some reviews that will be hard to take.
So how do you handle rejection?
For me it's a seesaw experience. Some days I'll receive a rejection letter and I'll think the agent/editor is swamped and didn't really understand what they were turning down. Other days it'll cut me to the quick and I'm sure I must give up the idea of being an author.
The thing I've learned over time is that you need to keep everything in perspective. A common comment I've received on rejection letters from agents I've queried is a reminder that this is a subjective business. What one person likes another may not and visa versa.
Keeping that in mind you also need to look back at the rejections you've received and ask some questions. For example, have you received some rejection letters that are not the usual form letter? A personal note should encourage you. They are not very common. Also, did the rejection come after a request for a partial or a full sample of your manuscript? This should also tell you something. Maybe your query letter needs to be amped up a bit. Maybe you need to get more feedback from your beta readers and punch up the manscript a bit more so that a partial leads to a full which will lead to a contract.
It's important to remember that a rejection is not a rejection of you. And it may be just what you need to get yourself moving toward the goal we all wish to achieve, which is having our work out there being read and enjoyed by others.