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();
           }

read my lips: DO NOT USE SCRIPTLETS.

And you're so incompetent you don't even know how to use them to do what you want to do, which I'm not going to tell you as you should never do that in the first place.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.