• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

object instance

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello!
In a jsp page i have the source code bellow:
if(request.getParameter("obj")==null)
{solti = new YYY.SolicitacaoTI(); }
With this object i full fill some fields of this page. In the first try, everything ok. But when i visit this page for the second time, the fields have the same information off the last time. Therefore, a new instance of this object it�s not created...why?
PS:
<jsp:useBean class="YYY.SolicitacaoTI" id="solti" scope="session"/>
However, i think that�s not the problem because i have another jsp page with the same procedury but with a diferente scope (request) and the same problem it�s happening....
What�s wrong?
PS2: Tomcat 5.0
Thank�s for your attention
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rafael,
You are very close to the problem (session vs request.)

When an object is stored in the request, it is deleted after each page load. So when you hit the page a second time, the object is gone.

However when an object is stored in the session, it stays there until the session times out or is invalidated. So when you hit the page a second time, the object is still there.
 
Rafael Fagundes
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jeanne Boyarsky:
Rafael,
You are very close to the problem (session vs request.)

When an object is stored in the request, it is deleted after each page load. So when you hit the page a second time, the object is gone.

However when an object is stored in the session, it stays there until the session times out or is invalidated. So when you hit the page a second time, the object is still there.



Thank�s a lot, you opened my eyes, hehehe
I was getting a problem when a used the scope request to the bean but it�s solved now...
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic