Use pageContext.forward(...) instead of <jsp:forward .../> in scriptlet.