如何在Java Web应用程序使用jQuery学习AJAX [英] How to learn AJAX using jQuery in a Java web app

查看:115
本文介绍了如何在Java Web应用程序使用jQuery学习AJAX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能指出我使用jQuery创建与Java(小服务程序)Ajax应用程序的教程。我一直在寻找的教程使用JQuery <在Java Web应用程序中实现Ajax / A >,它类似于我所需要的,但它不包括大部分的细节的

Can someone point me to tutorials using jQuery to create AJAX apps with Java (servlets). I was looking at the tutorial Implementing Ajax in Java web application using JQuery, which is similar to what I need, but it doesn't include most of the detail.

如果你知道一个很好的教程,文字+图形或视频或知道的主要步骤,并能概括他们,这将是AP preciated。我知道这似乎喜欢的事,应该很容易谷歌,并拿出答案,100S,但它不是,这就是为什么我问。谢谢你。

If you know of a good tutorial, text + graphics or video or know the main steps and can outline them, that would be appreciated. I know it seems like something that should be easy to Google and come up with 100s of answers, but it's not, which is why I am asking. Thanks.

推荐答案

他承担了很多关于他的听众。本教程针对谁知道Java的Web应用程序开发,至少在一些基层的人写的,已经处理了一些JavaScript,甚至尝试了jQuery的教程或两个。我觉得这是好的,因为它意味着有人谁的熟悉所有这一切将能在正确的跳跃,并获得问题的肉,而无需他们已经过滤掉所有的东西知道。也许一个段落在顶部解释这些假设将是一个不错的主意,但我离题...

He's assuming a lot about his audience. The tutorial is written for people who know Java web app development, at least to some basic level, and have dealt with a little Javascript, perhaps even tried a jquery tutorial or two. I think this is fine, as it means that someone who is familiar with all of that will be able to jump right in and get to the meat of the matter without having to filter out all the stuff they already know. Perhaps a paragraph at the top explaining those assumptions would be a good idea, but I digress...

什么跳出我作为一个潜在的小问题,就是天气的servlet是在ajaxify包:

What jumps out at me as a potential gotcha is that the weather servlet is in the ajaxify package:

                  V------see?
<servlet-class>ajaxify.WeatherServlet</servlet-class>

所以你需要确保你的 WeatherServlet.java 指定的包,或更改以匹配你在做什么。此外,没有提及,包括在的jquery.js 文件的&LT; HEAD&GT; 你的JSP:

so you will need to make sure you specify that package in WeatherServlet.java, or change it to match what you are doing. Also, no mention is made of including the jquery.js file in the <head> of your JSP:

<script type="text/javascript" src="jquery.js" />

显然,你将需要包括周围的形式,使之成为一个完整的HTML页面code,所以你将有一个&LT; HEAD&GT; 元素融入其中把各种&LT;脚本&GT; 标签。您还需要完成 WeatherServlet 类作为任何其他Java Web应用程序:

Obviously you will need to include code around the form to make it into a complete html page, so you will have a <head> element into which to put the various <script> tags. You will also need to complete the WeatherServlet class as in any other Java web application:

public class WeatherServlet extends HttpServlet
{
  ...

顺便说一句,我认为这是一个伟大的教程。我熟悉Servlets和JSP,知道Ajax背后的概念,知道的jQuery,并且已经搞砸与jQuery约十分钟。本教程完全填补国内空白,我知道我有周围的所有这些部分是如何结合在一起的。我不知道的jQuery可以让AJAX如此容易对付,而这将让我更加认真了解了很多到jQuery的。

BTW, I think it's a great tutorial. I am familiar with Servlets and JSP, know the concept behind AJAX, knew of jQuery, and have messed with jQuery for about ten minutes. The tutorial perfectly filled the gaps in my knowledge I had around how all those pieces fit together. I had no idea jQuery could make AJAX so easy to deal with, and this is going to get me to look a lot more seriously into jQuery.

这篇关于如何在Java Web应用程序使用jQuery学习AJAX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆