There is no standard tag to do that. So you should do it in the controller, or create your own tag that does it and use this tag in the JSP.
This doesn't look like view logic (i.e. markup generation logic) to me, so the best place is probably in the controller.