I have a webpage which shows some info. In my webpage I have many coordenates (lon, lat) and I want to make a java class to ordenate these coords.
Which I am trying to do is before showing coords, send them to the java servlet. This servlet would ordenate them and send back to the webpage to show them.
I want that webpage doesn't refresh so I think I need ajax to call servlet, I have it more or less under control. But I don't know how to receive data in java from a webpage.
I created some servlets in past but always calling java function using javascript. The problem of doing it by this way is that web browser goes to other webpage (jsp with java calls).
I don't have yet the code for ordering coords but I am using this to try:
package ordenacion;
public class OrdenarListaPuntos {
public static String ordenar(String cadenaDesordenada){ //String unordered
String cadenaOrdenada;
//here goes the code for ordering
cadenaOrdenada = cadenaDesordenada;
return cadenaOrdenada; //String ordered
}
}
I just know how to call java function from javascript using jsp but not from other webpages in other servers or without refreshing webpage...
Do you have any idea about how I should do it? Or what I should read about it?