aspose file tools*
The moose likes Servlets and the fly likes Scope of Jsp Variables, Urgent Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Scope of Jsp Variables, Urgent" Watch "Scope of Jsp Variables, Urgent" New topic
Author

Scope of Jsp Variables, Urgent

Kishan Kumar
Ranch Hand

Joined: Sep 26, 2000
Posts: 130
Hi all,
I am coding a JSP page in which iam declaring some variables and initialising to some initial values. In the course of the page these variables value are changed depending on business logic, everything is ok for the first time, but when i call the jsp for the second time it is not initialising to the initial values which i have set at the time of decleration, instead
it is keeping the values of the previous call. When i change those variables in bussiness logic it is changing but when my bussiness logic does not touch these variables i want my variables to have the initial values which i have set during the decleration, this is not happenning. Why on each call of the jsp, the decleration part is not executing, if it does not execute how do i accomplish my objective.
Thanks in Advance,

------------------
Regards,
V. Kishan Kumar


Regards,<BR>V. Kishan Kumar
Kishan Kumar
Ranch Hand

Joined: Sep 26, 2000
Posts: 130
Please somebody come forward to reply to my query.
Thanks In Advance
------------------
Regards,
V. Kishan Kumar
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
If your variable declarations are inside a <% %> section in your JSP, they will be initilaized on each request. If you wish them to remain between requests you should either put the values in the session, put the values in the servlet context, or declare them in a <%! %> section.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
 
Consider Paul's rocket mass heater.
 
subject: Scope of Jsp Variables, Urgent