简单的示例AJAX Web应用程序,包括客户端和服务器方面

时间:2022-09-06 21:37:03

I am trying to learn AJAX, and I am referring to online material and some books. I came to know that AJAX isn't a new technology as such, however, it is a way of using existing technologies for "faster" web-applications (or changing some part of the web-page without refreshing the whole page).

我正在尝试学习AJAX,我指的是在线资料和一些书籍。我开始知道AJAX不是一种新技术,但它是一种将现有技术用于“更快”的Web应用程序(或者在不刷新整个页面的情况下更改网页的某些部分)的方法。

Most of the code which I have seen in regards to AJAX, they are at client side (HTML, CSS and JavaScript). But how do I create a simple AJAX based web-application? I need something at the server side?

我见过的大多数关于AJAX的代码都是客户端(HTML,CSS和JavaScript)。但是,我如何创建一个简单的基于AJAX的Web应用程序?我需要服务器端的东西?

Can I used Apache Tomcat (and a servlet deployed) and URL mapping to fulfil a request initiated by a web-browser? Most of the books which I have seen, they haven't mentioned anything for what to do at server side, they talk only about the client side.

我是否可以使用Apache Tomcat(以及部署的servlet)和URL映射来完成Web浏览器发起的请求?我见过的大部分书籍,他们都没有提到在服务器端做什么,他们只谈客户端。

Can anyone help me how to approach in this regards?

任何人都可以帮我解决这个问题吗?

1 个解决方案

#1


0  

Ajax is for posting data to different server side APIs. We invoke server's API using our data, and server echoes its output back to us. On basis of the response, you modify the HTML or CSS. It is a client side thing, and which is the reason most books talk about only client side. Now when, it comes to server's response, it can be in xml, plain text or json(quite popular).

Ajax用于将数据发布到不同的服务器端API。我们使用我们的数据调用服务器的API,服务器将其输出回送给我们。根据响应,您可以修改HTML或CSS。这是客户端的事情,这也是大多数书籍只谈客户端的原因。现在,当涉及服务器的响应时,它可以是xml,纯文本或json(非常受欢迎)。

I guess, your servlets can be invoked in this way using AJAX. you can output data in json or xml format from servlets. That data comes to client side and then parsed using js or jquery(Whatever is you favourite)

我想,你可以使用AJAX以这种方式调用你的servlet。您可以从servlet以json或xml格式输出数据。该数据到达客户端然后使用js或jquery进行解析(无论你最喜欢什么)

How to use Servlets and Ajax? can be a good resource for reference

如何使用Servlets和Ajax?可以作为参考的好资源

#1


0  

Ajax is for posting data to different server side APIs. We invoke server's API using our data, and server echoes its output back to us. On basis of the response, you modify the HTML or CSS. It is a client side thing, and which is the reason most books talk about only client side. Now when, it comes to server's response, it can be in xml, plain text or json(quite popular).

Ajax用于将数据发布到不同的服务器端API。我们使用我们的数据调用服务器的API,服务器将其输出回送给我们。根据响应,您可以修改HTML或CSS。这是客户端的事情,这也是大多数书籍只谈客户端的原因。现在,当涉及服务器的响应时,它可以是xml,纯文本或json(非常受欢迎)。

I guess, your servlets can be invoked in this way using AJAX. you can output data in json or xml format from servlets. That data comes to client side and then parsed using js or jquery(Whatever is you favourite)

我想,你可以使用AJAX以这种方式调用你的servlet。您可以从servlet以json或xml格式输出数据。该数据到达客户端然后使用js或jquery进行解析(无论你最喜欢什么)

How to use Servlets and Ajax? can be a good resource for reference

如何使用Servlets和Ajax?可以作为参考的好资源