Originally posted by Murthy Cherukumilli:
hi!
I think the problem is with your jsp:usebean as the scope in this case is session, When you first visit the page a variable with name solti is looked into the session if available it will be reused or else a new one is created in the session scope... so the first time as the object is not available this variable is created. the second time when you come to this page as you are in the same session the object would still be present in the session and thus the same object will be used instead of the creating a new object. And for some reason the request parameter obj is not being null and so it would not reinitialize the object with a new location. But by doing new everytime youare coming to the page, specially the variable being the one in the session scope i thnk you are creating memory leasks also.. ofcourse this is a different thing all together.
So, check to see if you are even getting into the if block. use a print statement.
coming to other point where u said the scope was request ....that it self says that the your object is valid only for that request and so you might not be seing any issue.
And the session.removeAttribute("solti"), session.invalidate()... these method�s that i use on my "logoff page" should work, shouldn�t?....
My source code:
if(session.getAttribute("solti")==null)
{ solti = new YYY.SolicitacaoTI(); }
try{
if(quem.equals("1"))
{
dep = request.getParameter("dep");
nom = request.getParameter("nom");
if(!nom.equals("null"))
{
if(!nom.equals(""))
{
solicitacao = session.getAttribute("solti");
classe = solicitacao.getClass();
metodo = classe.getMethods()[getMetodo(classe.getMethods(),1)];
args[0] = new
String(nom);
metodo.invoke(solicitacao,args);
// old values come back from here, the old object reference (i dont think that�s a cache problem....)
centroc = classe.getField("centrocusto").get(solicitacao).toString();
tel = classe.getField("telefone").get(solicitacao).toString();
loc = classe.getField("local").get(solicitacao).toString();
locf = classe.getField("localf").get(solicitacao).toString();
ee = classe.getField("endeletronico").get(solicitacao).toString();
}
}
the page that�s finish the user�s operation has
Object solicitacao = session.getAttribute("solti");
Class classe =solicitacao.getClass();
Method metodo = classe.getMethods()[getMetodo(classe.getMethods())];
Object[] args = new Object[]{request.getParameter("txtaDesc"), request.getParameter("selTipo"), request.getParameter("selOrigem"), request.getParameter("textData"), request.getParameter("showTime")};
metodo.invoke(solicitacao,args);
session.removeAttribute("solti");
session.invalidate();
Thank�s again,
Rafael.