Hamilton's principle in continuum mechanics