将javascript var转换为java [英] Convert javascript var to java
本文介绍了将javascript var转换为java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想转换
var text1 = + location1.lat();
到java ...
以便我可以将java值从JSP传递给servlet
I want to convert
var text1 = +location1.lat();
to java...
so that i can pass the java value from the JSP to the servlet
推荐答案
JavaScript和Java是无关的。没有转换。要编写Java等价物,需要什么是位置
和location.lat
对象。你应该理解的主要内容:在JavaScript中,没有类,只有对象。每个对象都有其独立的成员集,并表示为关联容器。在Java中,只有类及其实例,对象。 Java是强类型。而不是var你应该写类型String
。
这是你需要开始的地方。其余部分取决于我提到的细节。
-SA
JavaScript and Java are unrelated. There is no "convert". To write Java equivalent, one would need what are thelocation
andlocation.lat
objects. Main thing you should understand: in JavaScript, there are no classes, there are only objects. Each object has its individual set of members and is represented as associative container. In Java, there are nothing but classes and their instances, objects. Java is strongly types. Instead of "var" you should write the typeString
.
This is where you need to start. The rest of it depends on the detail I mentioned.
—SA
这篇关于将javascript var转换为java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文