P
P.Hill
I guess I don't really understand the life cycle of a session object in a JSP
page. I would have thought that the following would leave the content bean
such that content.init() would only be called once, but all I have to do is
a refresh and I get a new call to init(). Doesn't the useBean
get an old bean if it can find one? Should I be using a <c:set .. > instead?
Please explain.
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<HEAD>
<TITLE>Testing</TITLE>
</HEAD>
<BODY>
<jsp:useBean id="content" scope="session" class="Content" />
<cut value="${content.test}" />
<c:if test="content.inited" >
<br />It was already initialized.
</c:if >
<c:if test="${!content.inited}" >
<br />It was NOT already initialized.
<% content.init(); %>
<br />But it is now.
</c:if >
</BODY>
</HTML>
Also is there an jstl way to call the init() method, so I don't have
to use a the scriplet:
<% content.init(); %>
?
TIA,
-Paul
page. I would have thought that the following would leave the content bean
such that content.init() would only be called once, but all I have to do is
a refresh and I get a new call to init(). Doesn't the useBean
get an old bean if it can find one? Should I be using a <c:set .. > instead?
Please explain.
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<HEAD>
<TITLE>Testing</TITLE>
</HEAD>
<BODY>
<jsp:useBean id="content" scope="session" class="Content" />
<cut value="${content.test}" />
<c:if test="content.inited" >
<br />It was already initialized.
</c:if >
<c:if test="${!content.inited}" >
<br />It was NOT already initialized.
<% content.init(); %>
<br />But it is now.
</c:if >
</BODY>
</HTML>
Also is there an jstl way to call the init() method, so I don't have
to use a the scriplet:
<% content.init(); %>
?
TIA,
-Paul