Templatizing servlets, getting rid of duplicated code