As for the War of 1812, it was really the Second war of Independence....during the 5 years previous to the war, over 1000 American ships were seized on the high seas, and over 7000 American men were kidnapped.
The British Parliament had ended the impressment policy before Congress declared war, but the news didn't get across the Atlantic until after the war was declared. If it had, it probably would never have been declared since the vote was rather narrow as it was.
The other two ostensible grievances were were that Britain was arming the Indians against settlers in the northwest and that it was interfering with American trade with France (this was during the Napoleonic Wars). But Americans shouldn't have been trying to take Indian lands in the first place--we know how that worked out--and, at the same time, France was trying to interfere in American trade with Britain. So why side with a brutal dictator like Napoleon over Britain, which was arguably the most liberal country at the time other then the USA? So there was no adequate cause that I can see, and it's not surprising it generated such widespread antiwar sentiment, perhaps even more so than Vietnam.
The war also eliminated the big government Federalist Party for good.
It led to the deaths of thousands, conscription in certain states, a failed invasion of Canada, the expansion the navy and the standing army, and war debt, which further led to inflation, the formation of the Second Bank of the United States, and the Panic of 1819.
What were the gains? Impressment had ended before the war had begun. The trade wars had ended with the end of the Napoleonic Wars in 1814 (before the end of the War of 1812). And Americans got to continue strong-arming the Indians off their lands. Other than that, there was a return to the status quo before the war. It eliminated the Federalist Party, but all the Federalists came into the Democratic-Republican Party and war fever and nationalism enveloped the mindset of the Democrats more than the Federalists, so the war also eliminated the Democratic-Republican Party as the party of Jeffersonian anti-federalism, turning it into a party of squishy "consensus." President Jefferson had made not be as liberal (in the classical sense) as he should have been, Madison and Monroe were even less so, and JQ Adams was a Federalist in all but name. Then the Party split again into the Democrats and Whigs.
The War of 1812 was a bad war, like all the others I can think of since the Revolution. It certainly was not a just war, under the traditionally high standards of that term.