在jsp文档中使用Google地图 [英] Google map in jsp document

查看:83
本文介绍了在jsp文档中使用Google地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将google map api实现到由jsp文档生成的我的一个网页中,并且我无法正常工作。我发现了一些由www.lamatek.com/GoogleMaps提供的jsp taglibrary,但它似乎不起作用(我的意思是,甚至在他们的网站上的例子都不起作用)。



有没有人在jsp文档中的谷歌地图上做过工作?我真的可以使用一些帮助或建议(看起来像jsp docuemnt和JavaScript只是不相处)。
$ b $ p我可以获得静态谷歌地图工作,但这是不是我的客户想要的。

解决方案

这实际上不是JSP问题。问题在于别的地方。也许这只是你自己对JSP的无知。您需要认识到,JSP是一种服务器端视图技术,它提供了一个用于编写HTML / CSS / JS的模板。您可以使用通常的方式编写plain vanilaHTML / CSS / JS一个JSP文件。除非您想要动态控制页面流或输出,或者希望用一个小标签替换重复/重复的代码块,否则不需要使用Taglib。后端数据可以使用表达式语言来访问。


(看起来像jsp docuemnt和javascript只是不相处)<如果你的实际问题是JSP和JS之间的沟通,那么你需要再一次认识到Java / Java语言中的Java / JSP基本上运行在服务器机器上,只是生成一个HTML页面(内部带有CSS / JS)并将其发送到客户端。 JS只能在客户端机器上运行,并且不会从JSP中看到任何内容。您可以使用JSP来动态生成JS函数/变量。您可以使用JS将(a)同步HTTP请求发送到服务器端,从而可以执行一些Java代码。要获得更多见解和示例,您可能会发现这篇文章有用。


ps我可以获得静态Google地图工作,但这不是我的客户想要的。


首先,将该静态 .html 文件重命名为动态 .jsp 文件,它仍然可以工作;)你不需要特定的taglibs。如果您想动态输出/呈现HTML / CSS / JS,请使用JSTL内核等流量控制标记。如果您想要动态访问后端数据,请使用EL。


I am trying to implement google map api into one of my web page which is generated by jsp document, and I am having trouble getting it work. I found some jsp taglibrary by www.lamatek.com/GoogleMaps, but it doesn't seem to work.(I mean even examples on their web site don't work)

Has anyone done work on google map in jsp document? I can really use some help or advice.(It seems like jsp docuemnt and javascript just don't get along)

p.s I can get static google map work, but that's not my client wants.

解决方案

This is really not a JSP problem. The problem lies somewhere else. Maybe it is just your own ignorace of JSP. You need to realize that JSP is nothing less or more than a server-side view technology which provides a template to write HTML/CSS/JS in. It is perfectly fine to write "plain vanila" HTML/CSS/JS the usual way in a JSP file. Taglibs are not required unless you want to control the page flow or output dynamically, or want to replace duplicated/repeated code blocks by a single small tag. Backend data can be accessed using Expression Language.

(It seems like jsp docuemnt and javascript just don't get along)

If your actual problem is the "communication" between JSP and JS, then you need to realize once again that Java/JSP basically runs at the server machine, just produces a HTML page (with CSS/JS inside) and sends it to the client side. JS in turn, only runs at the client machine and doesn't see anything from JSP. You can use JSP to generate JS functions/variables dynamically. You can use JS to fire (a)synchronous HTTP requests to the server side which in turn can execute some Java code. To get more insights and examples you may find this article useful.

p.s I can get static google map work, but that's not my client wants.

To start, just rename that static .html file to a dynamic .jsp file and it will still work ;) You don't need specific taglibs for it. If you want to output/render HTML/CSS/JS dynamically, use flow control tags like JSTL core. If you want to access backend data dynamically, use EL.

这篇关于在jsp文档中使用Google地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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