Hi everyone,
I'm having a hard time trying to create an object only once in a JSP file that I know works already, except that it always creates the object again with each page reload or submit request. I've tried session, not sure how it works.. but haven't figured it out.. either Does anyone know an EASY, simple way to just have the object on the page instantiated only once.
<%
// HttpSession session = request.getSession(true);
try {
c = (Triqui) request.getAttribute("c");
session.setAttribute("c", c);
if (c == null) {
out.println("c is null" + "<br>");
}
if (c != null) {
tc = (TriquiClient) request.getAttribute("tc");
session.setAttribute("tc", tc);
miSimbolo = tc.getSimbolo();
out.println("Mi Simbolo es: " + miSimbolo + "<br>");
id = tc.getId();
}
} catch (Exception ex) {
ex.printStackTrace();
}