Ajax和JSP的集成 [英] ajax and jsp integration

查看:101
本文介绍了Ajax和JSP的集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想捕捉,我已经建立了我的JSP中的responseXML。 我该怎么办。 从那以后,我将改变它的HTML。 我知道这很烦人,我们可以用一个框架或类似jQuery的库去做,但我知道它使用Ajax。 另外我有问题,jQuery和JSP \ servlet的,因为我必须使用JSON服务。 为什么在我看来,是那么的复杂。

I want to capture the responseXML that i have built in my jsp. What should I do. after that i will transform it in html. I know this is annoying and we could do it with a framework or a library like jquery but i realize it with ajax. Also i have problems with jquery and jsp\servlet since i must use a JSON SERVICE. Why it seems to me that is so complicated.

推荐答案

它并不需要那么复杂。你也许只需要一个自己调整所有的技术出来之一。 JSP,Servlet的,的 JavaScript的 HTML DOM HTML 和的阿贾克斯是它需要所有不同的技术需要学​​习和单独的理解。乱投医一起一次不理解他们分别将确实有可能导致更多的混乱,复杂和frustation,你碰到过。按照给定的链接,分别了解他们。了解跑步或骑自行车走之前。

It doesn't need to be that complicated. You maybe just need to align all the technologies out one by one yourself. JSP, Servlet, JavaScript, HTML DOM, HTML and Ajax are all separate technologies which needs to be learnt and understood separately. Trying everything together at once without understanding them separately will indeed likely lead to more confusion, complication and frustation as you encountered. Follow the given links to learn about them separately. Learn walking before running or cycling.

借助 jQuery的库只是删除了需要写入/重复全部code,以保持它的所有crossbrowser兼容。只有执行一个Ajax请求的crossbrowser方式已经远远超过了10行(精心writen /缩进)code。 jQuery的带来了它的最低限度,一个oneliner是可能的。

The jQuery library just removes the need to write/duplicate all the code to keep it all crossbrowser compatible. Only executing an Ajax request the crossbrowser way is already far over 10 lines of (well-writen/indented) code. jQuery brings it to an minimum, an oneliner is possible.

要了解更多有关JavaScript / AJAX和Java / JSP / Servlet的之间的墙,你会发现的这篇文章有用。我已经发布之前如何让JSP / Servlet的/阿贾克斯一起工作几个答案(虽然在使用JSON和jQuery,但几乎每个人都组合都会同意,JSON和jQuery是要走的路;的 JSON 是容易产生/使用的Java解析的谷歌GSON ,很容易建立/接入/过程中的JavaScript,因为它是语言本身的性质; jQuery是一个实际的革命的方式使用JavaScript)。 这里的是一个很好的起点,找到code例子我之前发布。

To learn more about the wall between JavaScript/Ajax and Java/JSP/Servlet, you may find this article useful. I've posted several answers before how to get JSP/Servlet/Ajax to work together (although in combination with JSON and jQuery, but almost everyone will agree that JSON and jQuery are the way to go; JSON is easy to generate/parse in Java using Google Gson and is easy to build/access/process in JavaScript as it is the language's own nature; jQuery is actually a revolution in the way you use JavaScript). Here's a good starting point to find code examples I posted before.

希望这有助于。

这篇关于Ajax和JSP的集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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