James Madison was the president of the United States during the War of 1812.