Illustration einer tropischen Insel mit Palmen und einem hohen Berg

Java Blog für Programmierer

AJAX in 50 simple lines: Requesting HTML and Producing JSP

· Christian Ullenboom

First we need a simple JSP as a service. http://localhost:8080/jsp/request.jsp?name=Chris

The JSP simply returns the length of the string. The format is simple text, no XML. Then we need a HTML page. It shows two text fields. One with an attached onkeyup() listener and one which displays the result, the length of the string in the first text field. The AJAX-request is inside a function called call() by the listener.

Der LängenmannNutzung online: http://localhost:8080/jsp/request.jsp?name=Chris.Name: Length: 

The best solution is to use an AJAX framework like prototype, but this is only a very simple example „how this stuff works“ (is there a copyright on the sentence?)

Kategorien: Allgemein

← Alle Beiträge