You can rely on the existence of a well-known attribute in session.
Set this when the session is first created.
session.setAttribute("well-known-attribute", "abcd");
In your JSP, check if this attribute exists before you do any iterations.
if(session.getAttribute("well-known-attribute") != null) {
// iterate others now
} else {
session.setAttribute("well-known-attribute", "abcd");
// now add the other attributes.
}
A new session will always be created if
- There isn't one already AND
- There is a request associated.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…