0

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();
           }
2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by jwenting
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.