Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!

Gayan Balasooriya

Ranch Hand
+ Follow
since Jul 31, 2002
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
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Gayan Balasooriya

Originally posted by Meng XiaoXi:
who can tell me the IP address of, my DNS cannot find it. thanks., is hosted as a virtual host.You cannot get the IP address fo this domain.
Hi Prasanna,
I'm from Sri Lanka. But I'm not going to take this beta exam. If you have a
free voucher you can do the exam for free at a Prometric Testing center here.I've done a beta exam with a free Sun exam voucher before.
Gayan Balasooriya
SCJP,SCWCD (Coming Soon)
Hi Richard,
I have learned a lot from your books.We're lucky to have you as the moderator.
Gayan Balasooriya
I added a new section SCMAD Experiences.It contains all the links to exam experience posts on this
Hi friends,
I'm encouraged by your comments.
I have created a website dedicated to SCMAD.
You may find it useful.I will add more useful contents soon.
Check it out
Gayan Balasooriya

Originally posted by Adnan Ahmed:
Hi Jojit
I think this is not right way to invoke doHead method of servlet. Because to invoke doGet u r using form tag of html and the attribute "method" of form just support two HTTP method either get or post.
And the reason the page invoking doget is that the form using invalid method thats why form default method will be called which is Get.
If i m right then tell me

I think you are correct.According to HTML specification METHOD attribute of
FORM tag can be only GET or POST.
Read this

Gayan Balasooriya
SCJP,SCWCD - Free Java/J2EE/J2ME books and mock exams
14 years ago
Here's another good explanation from
When you invoke a Servlet, the servlet engine passes the information on to the Servlets service() method. This method determines the type of request made (GET, POST, HEAD, ...) and calls the function doTYPE, like doGet, doPost. GET and POST just differ in the way form data is sent from the browser to the server. The method doGet handles data that has been attached to the url in the form url questionmark (name=value ampersand)+. Typically in a CGI you would have to read the environment variable QUERY_STRING to get this string of concatenated parameternames and values. With the doPost method, form data comes in through standard input stream, a cgi would just need to open the input stream and read until EOF to get the form data.
With Servlets, you don't need to read in the concatenated string of parameternames and values. The parsing is all done behind the scenes. You just need to call getParameter regardless of how the form data is actually sent in.

Gayan Balasooriya
SCJP,SCWCD - Free Java/J2EE/J2ME books and mock exams
14 years ago
There is no doHead() method defined in HttpServlet class in 2.2 API.
But it is there in 2.3 API.
And the correct method is
doHead(HttpServletRequest req, HttpServletResponse resp)
throws ServletException,
not doHead().
Gayan Balasooriya
SCJP,SCWCD - Free Java/J2EE/J2ME books and mock exams
14 years ago
You can use javax.servlet.RequestDispatcher to add parameters to the request
and forwad it to another servlet for processing.
// Set attributes
req.setAttribute("id1", new Integer(12));
// Get dispatcher with a relative URL
RequestDispatcher dis = req.getRequestDispatcher("../AnotherServlet");
// or forward
dis.forward(req, res);
Gayan Balasooriya
SCJP,SCWCD - Free Java/J2EE/J2ME books and mock exams
14 years ago
This method disables caching at the proxy and client browser
// Set to expire far in the past.
response.setHeader("Expires", "Sat, 6 May 1995 12:00:00 GMT");
// Set standard HTTP/1.1 no-cache headers.
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
// Set IE extended HTTP/1.1 no-cache headers (use addHeader).
response.addHeader("Cache-Control", "post-check=0, pre-check=0");
// Set standard HTTP/1.0 no-cache header.
response.setHeader("Pragma", "no-cache");
Gayan Balasooriya
SCJP,SCWCD - Free Java/J2EE books and mock exams
[ October 21, 2003: Message edited by: Gayan Balasooriya ]
14 years ago
I have collected some mock exams and study notes for SCBCD.

[ September 23, 2003: Message edited by: Gayan Balasooriya ]