May 05

How to get the Web Page’s Source Code?

In order to do it, you can do it as it is shown:

package com.mx.development;

 

import java.io.BufferedReader;

import java.io.InputStreamReader;

import java.net.URL;

import java.net.URLConnection;

 

public class URLConnectionReader {

public static void main(String[] args) throws Exception {

URL oracle = new URL(“http://www.oracle.com/index.html”);

URLConnection yc = oracle.openConnection();

BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream()));

String inputLine;

while ((inputLine = in.readLine()) != null)

System.out.println(inputLine);

in.close();

}

}

Jan 27

Difference between HashMap vs HashTable

Browsing on the web I found the main diferences between HashMap and HashTable:

  1. A  HashTable and HashMap are key-value’s pair of object, It means that for each inserted object must exist an unique key. On a HashMap you can add NULL values on the KEY as well as the value.
  2. Hastable no implementa ningún método sincronizado; es decir desde su nacimiento no son thread-safe.
  3. Una de las subclases HashMap es LinkedHashMap, así que en el caso de que usted querría previsible orden de iteración (que es el orden de inserción por defecto), usted puede intercambiar el HashMap de LinkedHashMap. Esto no sería tan fácil si estuviera utilizando Hashtable.
  4. HashTable para búsquedas es más rápido que HashMap.

Jan 26

Spring + Hibernate

Here I add the useful links that I found about the use Spring + Hibernate Frameworks.

  1. http://www.vaannila.com/spring/spring-hibernate-integration-1.html
  2. http://www.adictosaltrabajo.com/tutoriales/tutoriales.php?pagina=desarrolloRapidoJava
  3. http://www.dosideas.com/wiki/Hibernate_Con_Spring

Jan 18

Diference between a filter and a Listener in J2EE

Browsing at  internet I found this little but clear article.. I share with all of you:

Text from Java EE 6

Filter

Filter is an object which transform the request and response (header as well as content).

Listeners

You can monitor and react to events in a servlet’s life cycle by defining listener objects whose methods get invoked when life cycle events occur.

Jan 03

OOP

Object Oriented Programming:

Older posts «