This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!

AmitVijay AVKulkarni

Greenhorn
+ Follow
since Apr 26, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by AmitVijay AVKulkarni

Hi,

I am working the field of Banking where I am developing applications in J2EE. I need to do few things in J2Me. Can anybody tell me please that for J2ME which book should I refer? As well as how should I start learning process of J2ME.

Amit Kulkarni
11 years ago


Heartiest Congratulations !!!

- Amit


Dear all,

I am using JDBC Type 3 driver for Oracle database. I am using classes12.jar. In this we have a class called oracle.jdbc.driver.OracleDriver. When we are creating a connection with a database first statement we write is

Class.forName("oracle.jdbc.driver.OracleDriver");

Can anybody tell me exactly how this functions? I mean when we say Class.forName("ABC"), this causes class named ABC to be initilized or it creates a copy of the class ABC.

What happens to copy of class ABC if it is already there?

~ Amit
[ July 27, 2005: Message edited by: Bear Bibeault ]

Dear all,

If I have a Vector which has say some values taken from database. Now I want to extract those values, I can use either Enumeration or Iterator.

So can anybody tell me what is a difference these two? And which is a best to use?

~ Amit
13 years ago
Dear Narendra,

What Kedar has written is right.
(1) Basically web.xml is a deployment descriptor for application.
When you have servlets in application you require
1.1) web.xml : Using web.xml developers can
declare initialization parameters for Servlets (ServletConfig)
and initialization parameters for application (ServletContext).
Not only this but some times we also require init parameters for
jsp. So they can be given to jsp using web.xml
We can also configure session timeouts, listerners etc. So
web.xml(deployment descriptor) is required
1.2) WEB-INF -> classes : In this directory we store servlets,java
beans, utility classes. So this also required.
1.3) WEB-INF -> lib : Some times we use third party library i.e.
jar files in our application. That time we keep these lib files
in lib directory. If you dont want to use this directory you can
keep library i.e. jar file in common/lib folder which is under
Tomcat Home Directory.

So if you are using only jsp based application, then you might be having few java beans used with it. So these all directories are required.

~Amit


Dear all,

A web application with Jsp and Servlet is deployed in Tomcat. And we start accessing that application through web browser. After this if we make any change in servlet and redeploy that new servlet, then we have restart Tomcat to see the changed servlet. But if we make any changes to Jsp we dont have to restart Tomcat. Why is so? Means behind the scene, jsp is translated to servlet and this servlet is catering to requests sent by client.

So can anybody kindly throw a light on this .

Amit
Dear Ramasamy ,

Different types of content types are:

(1) application/pdf
(2) video/quicktime
(3) application/java
(4) image/jpeg
(5) application/jar

and some more.

You can find the list of content types in Head First Servlets & JSP book on page no 130 and chapter no 4.

~Amit Kulkarni
Dear Johny ,

Heartiest Congratulations !!!





Amit
Dear all,

Please go through the following code. Also I am giving output of the code.
I need to find out how this is happening?

class Outer3 extends OuterTest
{
static
{
System.out.println("static block");
}

Inner3 i = new Inner3();

public Outer3()
{
System.out.println("Outer1 constructor");
}

class Inner3
{
public Inner3()
{
System.out.println("Inner1 constructor");
}
}


}

public class OuterTest
{
public OuterTest()
{
System.out.println("OuterTest constructor");
}

public OuterTest(int pInt)
{
System.out.println("OuterTest constructor pInt : "+pInt);
}
public static void main(String args[])
{
Outer3 o = new Outer3();
}
};

When I compile and run this code the output I get is

static block
OuterTest constructor
Inner1 constructor
Outer1 constructor

regards,
Amit
13 years ago
Dear all,

Can anybody explain me the difference between init(ServletConfig config)
method and init() method.
API says simply override no arg init() method which will be called by
init(ServletConfig config) method? What do you mean by this?

Kindly explain.....................


regards,
Amit Kulkarni
Dear all,

I have one html page which calling a servlet. In this servlet service method is overridden. In form tag of html page method is either GET or POST. So after I click submit button in html page it calls servlet and servlet executes. So how this happens?

I am also giving code below

Test.html

<HTML>
<HEAD>
</HEAD>
<BODY>
<form name="e" method="POST" action="/servlet/TestServlet">
<INPUT TYPE="submit" value="Submit">
</form>
</BODY>
</HTML>

On submit it is calling TestServlet

package com.test.servlet;

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;


public class TestServlet extends HttpServlet
{
public void service(HttpServletRequest Req,HttpServletResponse Res)
{
try
{
PrintWriter out = Res.getWriter();
out.println("http://www.javaranch.com");
}
catch (Exception e)
{
e.printStackTrace();
}
}
}

How this service method written in servlet is identifying get or post method?

regards,
Amit Kulkarni
[ July 07, 2005: Message edited by: AmitVijay AVKulkarni ]
Dear Amit,

I will try to explain you the difference between getAttribute and getParameter.

(1) getParameter:

For E.g. There is one html page named Test.html and servlet named Test
Test.html contains few parameters for user registration on
web site and those parameters you want to store in database.

Sample Code for Test.html

<html>
<body>
<form name="reg" method="post" action="/servlet/Test">
<table>
<tr>
<td>
<input type="text" name="FIRSTNAME" size="25">
</td>
</tr>
<tr>
<td>
<input type="Submit" value="Submit">
</td>
</tr>
</table>
</form>
</body>
</html>

When user will enter value in the text field and press submit button, it will call Test servlet. Now you want the value entered in textfield by user in servlet so there you use getParameter method.

String lFirstName = request.getParameter("FIRSTNAME");
(This you will write in your servlet)

This method is responsible to take values from prevoius page to the forwarded page. Using this method you can retrive only one value. This method i.e. getParameter method is in ServletRequest interface which is part of javax.servlet package.


(2) getAttribute :

You want to take values from database in servlet and display them in jsp. Now you have resultset filled with data ready in servlet then you use getAttribute method and send this resultset to jsp where it can extracted and result is shown to the user.

in servlet -->

ResultSet lResultSet = // code to get data.
request.getAttribute("EMPDATA",lResultSet);

in jsp -->

ResultSet lResultSet = (ResultSet)request.getAttribute("EMPDATA");

So using getAttribute one can retrive resultset or java bean etc. getAttribute method is present in Servlet Interface which is a part of javax.servlet package.


I hope this will help you.

regards,
Amit Kulkarni
Dear all,

Can anybody tell me the difference between

(1) Http Server and Web Server?
(2) Web Server And Appplication Server?
(3) Http Server And Application Server?

regards,
Amit Kulkarni
Dear Suresh,

!!! Congratulations !!!

Can plz help me out? I am planning to appear for SCWCD exam. I just wanted to confirm that the specifications covered in SCWCD exam are Servlet 2.4 and Jsp 2.0. ??? Is it right?

Amit Kulkarni
Dear All,

I was going through SCWCD FAQ's (on javaranch) where it is mentioned that Servlet 2.3 and Jsp 1.2 Specifications are part of SCWCD exam. But I feel it Servlet 2.4 and Jsp 2.0. Can somebody help me out in this?


regards,
Amit Kulkarni