I have made a web-based application using JSP & servlets.
1) Query Whenever my application is interacting the database for getting ResultsSet i am setting the request attribute as
request.setAttribute("ROWSFOUND","NO"); if no rows are found else request.setAttribute("ROWSFOUND","YES"); if rows are found
So what i would like know is that everytime a object would get created for attribute 'ROWSFOUND' or the same object values will be REPLACED for this attribute??
Because if everytime the object for attribute 'ROWSFOUND' would get created then it will take a lot of memory because i m not removing this request attribute.So if this is the thing what should i do?? And i dont want to remove this manually because if i would do that i will have to write a removeAttribute() statement in my each class which is interacting with the database & i have a lot of classes.
2) QueryI want to write a SessionListener class for this application which can automatically remove the session attribute's objects created after a particular time. So how to do this??
Originally posted by geetu lalchandani: Boolean will still be a object right.. how does it make a difference to use Boolean or String(performance wise).
Using Boolean will be more efficient because you won't have to do String comparisons... BUT that's a minor consideration. You should choose to use Boolean because it makes more sense than using strings with "YES" and "NO' or "TRUE" and "FALSE".