Shamaila Mahmood

+ Follow
since Aug 28, 2001
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by Shamaila Mahmood

I also was confused about this step. I think by

JSP Compilation --> page translation

means that first jsp engine compiles the jsp page and finds any error in the page that's why we get compile time errors on jsp page this step invloves two stages

  1. Jsp page compilation (JSP Compilation )
  2. translation into servlet and compilation of servlet (page translation )

  3. second compilation that takes place when the servlet is compiled into class. I think we can not call this step as Page compilation rather it should be called servlet compilation step(I think so).
    I want to know the exact meaning of these steps. I also mailed my problem to Ken but not got satisfactory answer, anyways thanks Ken for such a quick reply.

Originally posted by Khanh Nguyen:
Shamaila - I got two questions for clarification purposes. So if num was not a private variable then num would not be thread safe. Or if within doGet, num is set to a different value then num would not be threadsafe also. (

(first question) If num was not a private variable:
Actually static variable are not thread safe as all the instances of this class can access/modify them either by onjectName.staticVariableName or by ServletClassName.staticVariableName,
but as num is a private variable so you can not access it in either of these two ways.
But any method of the servlet class can modify its value. so all the instances of servlet class can modify the same static variable even if it is private. That's why private static variables can not be considered as thread safe.
(second question)if within doGet, num is set to a different value then num would not be threadsafe also:
In all the cases where we know that no method of the servlet class modify the value of a variable(static or instance) then we can say that this variable is theard safe. So thread safety of a variable depends upon the code. means depending on the imlementation of the servlet you can say that a particualr variable is thread safe even if the variable is an instance variable.
The question is a bit tricky, no doubt answer appears to be D. Here is an attempt to justify the sun's answer. As the variable num is static it is not associated to a particular instance but being a private member it cannot be accessed using Class.method() syntax. The only way of changing the value of this variable is to set it within the class. So here is a variable that can only be changed by
1)class's methods
2)static initializer
3)instance initializer
But in the case of this question none of above is changing value of the variable num. That's what make it thread safe. I drew this conclusion from the comment in the doGet... //do nothing
Just a guess
Kodo Tan:
As i said earlier that custom tags can replace JavaBean components in all cases but i used Beans in the following cases

  • when I had to deliver some part of my project in a very short period of time
  • I older projects where JavaBeans where used and i had to change some part of it with out changing the jsp version.

  • I think beans are good tool for beginers and useful in rapid application development if do not want to complicate the process.

I think custom tags can replace JavaBean components in all cases.
The primary difference between them are

  1. Beans can not manipulate JSP contents while custom tags can
  2. With the use of custom tags the presentation logic and be separated from business logic completely.
  3. Custom tags can be developed by a Developer and used by a designer while a designer can not use Beans if he does not know Java.

here is the detail of chapters of Inside servlets
Chpater Name (No) | Objectives
Beyond Web Basics (3) (Section HTTP) | (1.2, 6.3)
Servlet Basics (5) (Servlet Life Cycle)| (1.5)
Servlet API... (6) | (1.1, 1.2 ,1.3, 1.5, 4.1)
Beyond Servlet...(10) (ServletConfig, ServletContext) | (1.3)
Thread Safe Servlets11 | (7)
Http Redirect(12) |
Session and State Management(14) | (5)
Server side Include... (15) (RequestDispatcher) | (1.6)
Congrats Rajat, I feel your success story will help us in our paper too.
Jimmy Blakely,
Yah inside servlet is for beginers, I think you do not need to read all the chapters. I can give u the list of the chapters that are important (if u are not a beginer, beginers should read or go through all the chapters). Before starting my studies I read the specs and find the chapters that should be read from many books. After preparing list of chapters from books I started my study.
I found two books that are excellent
1) "Core Servlets and Java Server Pages"
2) "Inside servlets by callaway"
Java server Programming is good but I found above books more useful
I have got a good tool to understand Request and Response headers. Its a protocol explorer. Returns the response header and contents of the request.
Get is the default method of form submission. A browser generates GET requeest when user
Types a URL on address bar
Follows a link
Submits a form having method=GET
Submit a form that does not specify a method
POST is generated when the user
submits a form having method=POST
doGet method is called when you submit a form having method=GET. doPost is called when you submit a form having method=POST then
Difference between them are
with get method, the query string is passed along with the request URL of the page so one can see the query string at the address bar of the browser. While in Post the query string is passed at the end of request header. So the request parameters can not be seen at the address or status bar. So post is secure while taking password or Credit card information
As get method passes form input elements with its URL so there is a limited amount of information that can ne passed with this method. The amount of information depends upon the browser. But with Post method you can send as much amount as you want.
wow its a good site, I had some questions regarding my project I got answers of my questions
oh great score, Congrats would you like to share your note with me. Please could you tell me From where should I study for Thread safty(Section 7)
you have put <web-app> at the end of code instead of </web-app>

I am going to take Sun Certified Web Component Developer exam. I want to download latest version of Jakarta Tomcat. From where I can download it? I have used tomact 3.2.2 is the latest version much different then that?