This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes JSP declaration tag and Scriptlet tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "JSP declaration tag and Scriptlet tag" Watch "JSP declaration tag and Scriptlet tag" New topic
Author

JSP declaration tag and Scriptlet tag

Anoop Krishnan
Ranch Hand

Joined: May 03, 2001
Posts: 163
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).]


I just want to know is there any body call my bean's Getter and Setter methods with "Please" in front - My favorite quip from Bugzilla
Dharmesh Chheda
Ranch Hand

Joined: May 08, 2001
Posts: 204
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


regards,<br />Dharmesh Chheda
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JSP declaration tag and Scriptlet tag
 
Similar Threads
How to pass a data through html:link in struts
Dynamic HTML page titles using jsp
JSTL doubts (c:if)
f:param
Session Value Persistence