My advice is to punt back and remove
all Java from your JSPs and adopt scriptless pages using an MVC architeture and the JSTL/EL.
But if that's too big a step for you I'd at least put the common code into an include file so that it exists only once in the source tree.
But think of my first suggestion. Seriously.
Really.