Is the code in the JSP there in order to format the display? Or is it there to perform processing and/or business logic?
If the latter, your page could be a 'poster child' for urging people to consider the Model 2
pattern. In this pattern (skip to end if you've heard all this before), the URL hits a
servlet (not the JSP), performs whatever non-display processing is necessary to satisfy the request, then forwards on to the JSP for display (perhaps tacking necessary data structures onto the request for retrieval by the JSP). This keeps your JSP focused on the display, and not complicated by misplaced non-display logic.
If you have already adopted Model 2, but your display design is so complicated that it requires vastly complex on-page
Java to sort out, investigate the use of custom tags to factor the logic out of the page.
hth,
bear