Kumar Kamlesh

Greenhorn
+ Follow
since May 10, 2009
Merit badge: grant badges
For More
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 Kumar Kamlesh

Hi,

I have also encountered such cases during my project. So just to clear my doubt, does the following line:

The next level would be to load the properties just once, and store the Properties object, and return the same object every time the method is called.



indicate the need of a singleton class or is there a better way to do the same?

- Kamlesh
14 years ago
Hi,

I want to learn Java in depth. I have been refering to Kathy Sierra for Core Java and Head First Servlet and JSP for J2EE. I want to learn Java beyond the scope of these books as these books are exam oriented albeit they are master piece. Please guide me as to which books or reference materials I should persue in order to increase my knowledge in Java/J2EE.

Regards,
Kamlesh
14 years ago
Hi Nirjari,

The syntax of the JSP seems to be fine. You may debug more into the tag libraries and the tag handler classes being used in this JSP.

- Kamlesh
14 years ago
JSP
Yes, you are right. Actually I have not got a chance to use Scanner class. It is just what I tried in order to identify and solve the problem. Thanks for pointing it out.

14 years ago
Have you tried using request.getRemoteHost() method to know from where the request is coming.

- Kamlesh
14 years ago
Using a session variable for this purpose would be straight forward, but what if a user closes the session after two wrong attempts within 15 minutes. And he tries the third wrong attempt in a new session. So it depends upon the design of your application as to how you want to handle this. May be using a database variable would do (as suggested above) if your design permits you. There can be other ways too.
14 years ago
Licenses can be classified as license required to procure a software [which includes various costs] and license required to use the software [which includes the modifications in the source code, distribution, copyrights etc; to be more open source specific].

On the download page of Sun's J2SE 5.0 JDK Source Code you can find Sun Community Source License (SCSL) and Java Research License (JRL).

Correct me if I am wrong.
14 years ago
As the home page of OpenJDK itself says. It is :

the place to collaborate on an open-source implementation of the Java Platform, Standard Edition, and related projects.



So again it boils down to the implementation part.

Having an insight of the various open source licenses (GPL, LGPL etc) available may also help catalyzing your debate.

Try to compare Sun's Java J2SE license and that of the OpenJDK.
14 years ago
Java as a specification is open source but its implementation is vendor specific.
14 years ago
Just add

input = new Scanner( System.in ); //at line 58

before you are doing

employeeName = input.nextLine(); // read a line of text

in the loop.

Hope its not too late!

- Kamlesh
A Student of Java
14 years ago
Ankit,

Java supports primitive data types such as byte, short, int, long, boolean etc. Since Java is a Object Oriented Programming language it provides a special class for each of the data type known as wrapper classes. For example, for int you have Integer, for long you have Long, for boolean you have Boolean and so on. Wrapper classes provide you the mean to convert a primitive type into corresponding wrapper type and vice versa. They also contain many utility methods in addition. For details you can refer to java documentation.

Autoboxing is a feature of Java SE 5, which automatically does the conversion between a primitive type to its wrapper type and vice versa. In your given example the following:

char c = ch;

won't work in the versions of java prior to Java SE 5. For the previous versions you explicitly need to write the code for conversion.

Hope this explains your question.

- Kamlesh
A Student of Java
14 years ago
Vineet,

Since I have not used JChart and Cewolf, I can not comment on that. But I am sure you can generate rectangles and squares using java.awt.Graphics2D class. Have a look at the APIs provided by Graphics2D and BufferedImage class. Specially the drawImage() method of Graphics2D class and the constructor of BufferedImage class.

- Kamlesh
14 years ago
Vineet,

You can write a generic function to generate shapes based on user's input. For example if you have to draw a rectangle, you can take the width and height as the argument of the function and you can generate the shape. Some of the APIs you can use to generate shapes are:

java.awt.Color, java.awt.Font, java.awt.FontMetrics, java.awt.Graphics2D etc.

You can call this function in the service method of your servlet to generate the image passing the required inputs for image generation. For writing the image on the server you need to do following things:

1. Set the content type to image/jpg. [This is must]
2. Use ImageIO to write the image to servlet.
3. Write a HTML image tag in your jsp which simply points to your servlet. (Also pass the required inputs, you may use query string)

Code snippet for Step 1 & 2:


Hope this helps.

- Kamlesh
14 years ago
You can make your applications REST based, which can exchange data from any other web application using JSON.

- Kamlesh
14 years ago

how container create threads of servlet and what method or instance has been shared beetween threads.



Servlet typically handles multiple requests by creating threads of service method.

- Kamlesh
14 years ago