You don't need to split the bean. You could just split the page fragments over multiple files which you include by <jsp:include>
(and not by @include
as that happens during compiletime and you would end up with still the same exception!). Note that you should store those include files in /WEB-INF
folder to prevent direct access by enduser.
So given this example of an "extremely large" page,
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div>
large chunk 1
</div>
<div>
large chunk 2
</div>
<div>
large chunk 3
</div>
</body>
</html>
You could split it as follows while keeping the beans:
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<jsp:include page="/WEB-INF/includes/include1.jsp" />
<jsp:include page="/WEB-INF/includes/include2.jsp" />
<jsp:include page="/WEB-INF/includes/include3.jsp" />
</body>
</html>
and /WEB-INF/includes/include1.jsp
:
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<div>
large chunk 1
</div>
and /WEB-INF/includes/include2.jsp
:
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<div>
large chunk 2
</div>
and /WEB-INF/includes/include3.jsp
:
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<div>
large chunk 3
</div>