Basically war is never an answer.... However sometimes it's inevitable. Pacifism will in the end also not always work. We've seen tons of misery already because people didn't wanna have blood on their hands and tried to avoid a war, only to get blood on their hands anyway.
WWII is a perfect example of how people tried to prevent a war, against better judgment as WWII was sure to come, and perhaps a lot of shit could have been prevented had people not been afraid to have blood on their hands... of course this is guessing work, as blaming WWII on Hitler alone is not doing history justice, as there was more to it, but we can say that people did try to turn a blind eye on Hitler a long time afraid for a war, which everybody knew was coming anyway.
In the most general sense war itself is never the answer. Perhaps we should rather think in the question should we act when we know it will mean war, but what would happen if we do nothing? When people are set on it to start a war, they will do so anyway, and being the pacifist looking away is in a certain way, just as bad, although it's then only a bit harder to say whose blood is on your hands.
If a war CAN be prevented, it's as a basic rule always a good thing, but one should think further than war alone. The world is ruled by idiots after all, and as long as that doesn't change a lot of misery will happen, with or without war. I think it's an illusion to think that we could make the occupation of ISIS of the grounds they unrightfully claimed as their "caliphate" without violence, thus war... And what would have happened if that war wasn't fought... right... ISIS would have become more and more powerful with all the crap that brings along. Was war the "answer"? No... merely something that could not be avoided... I see it rather as a "side-effect" of trying to bring them down knowing they'd use violence to defend themselves.
I hate war. It's a disgrace for the human race. It would be better if there were no more war. But looking away, afraid to make your hands dirty on war, isn't always an option either... It's a reality we all have to accept.