public class Embed extends HttpServlet {
private int cnt = 0;
public void service(HttpServletRequest request, HttpServletResponse response)
throws javax.servlet.ServletException, java.io.IOException {
final Desktop desktop = getDesktop(request);
Bridge bridge = Bridge.start(getServletContext(), request, response, desktop);
try {
final Listbox listbox = (Listbox) ((Page)desktop.getPages().iterator().next()).getRoots().iterator().next();
listbox.appendChild(new Listitem("Ajax " + ++cnt));
response.getWriter().write(bridge.getResult());
} finally {
bridge.close();
}
}