• 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

JSP declaration tag and Scriptlet tag

 
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Plaese see this simple jsp tags and tell me which one is safe in place of memory usage and in multiple threads
code 1
<%!
String value;
%>
<%
value=request.getParameter("id");
%>
code 2
<%
String value=request.getParameter(id);
%>
[This message has been edited by Anoop Krishnan (edited May 22, 2001).]
 
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello anoop
well in code 1, if you open multiple browser windows, then in that case value will hold the latest value .. for example
suppose you declare value as
<%! int value=0 ; %>
and in your code suppose you do
<% value=value+1;%>
then when you open one browser value you will get the value of the variable "value" as 1.

Again if you open another window and re run your code and get the value of the variable "value" then it will not hold one it will hold two.
So in this case the value is persistent
Where as in code 2 the variable "value" will remain local for each particular session.
i hope this clears your doubt .. in case i am wrong correct me or in case you didnt get it ... send a reply
bye
 
Thanks tiny ad, for helping me escape the terrible comfort of this chair.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic