I need to store the information of user's location?
could you try store user's information into cookies?
Main Topics
Browse All TopicsI am trying to create a Java web application with google api. I will be able to locate a user's location and mark it on the google map. Then, I need to store the information of user's location. How exactly I can do this?
I try to use google.loader.ClientLocati
What can I do to make this work?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Error Message...
javax.script.ScriptExcepti
at com.sun.script.javascript.
at com.sun.script.javascript.
at com.unet.googleproject.ser
at sun.reflect.NativeMethodAc
at sun.reflect.NativeMethodAc
at sun.reflect.DelegatingMeth
at java.lang.reflect.Method.i
at com.google.gwt.user.server
at com.google.gwt.user.server
at com.google.gwt.user.server
at javax.servlet.http.HttpSer
at javax.servlet.http.HttpSer
at org.mortbay.jetty.servlet.
at org.mortbay.jetty.servlet.
at com.google.apphosting.util
at org.mortbay.jetty.servlet.
at org.mortbay.jetty.servlet.
at org.mortbay.jetty.security
at org.mortbay.jetty.servlet.
at org.mortbay.jetty.handler.
at org.mortbay.jetty.webapp.W
at com.google.apphosting.util
at org.mortbay.jetty.handler.
at com.google.appengine.tools
at org.mortbay.jetty.handler.
at org.mortbay.jetty.Server.h
at org.mortbay.jetty.HttpConn
at org.mortbay.jetty.HttpConn
at org.mortbay.jetty.HttpPars
at org.mortbay.jetty.HttpPars
at org.mortbay.jetty.HttpConn
at org.mortbay.io.nio.SelectC
at org.mortbay.thread.Bounded
xenia27,
Java and Javascript are two completely different languages and run at different times in a web page's "life." Java would be done by the server or maybe an applet; Javascript is run by the browser. This is why variables of one won't be available to the other.
What exactly do you mean a Java web app? Google's API uses Javascript and you would use Javascript to work with it in your browser. At least the part that is used for maps? What is the code you are trying to use to locate the location? What API exactly? The ClientLocation property I have seen in Google's API is related to their AJAX API. It is Javascript which is used to work with it. If you are having a problem with it then please provide more specifics on the code and when this problem occurs in relation to what you are doing.
Let me know if you have any questions or need more information.
b0lsc0tt
>>How can I avoid this situation?
You need to check that it's not null first. See http://code.google.com/api
as b0lsc0tt points out above (and you appear to have ignored) you're not loading the google js, or creating cl.
What you do in your html is completely independent to what you do in your java code.
ie. your html has nothing to do with your problem, you need to load the google js, and create cl in your *java* code if that where you want to use it.
Or make the call in your html (instead of java) and update the html dynamically.
Java isn't my expertise so may be it does have a way to run Javascript as a browser would and get and results or responses. I do know a key is a required part of the request to Google's API. Let me know if you need info on how to get it.
This actually brings us to a possible issue. Even if Java provides a way to do it the key is tied to a domain. Although the key can also work for "localhost" test it won't work from just anywhere. This may be an issue that will cause your efforts to not work but I don't know enough about how Java would use the script to know for sure.
Let me know if you have a question or how this helps.
bol
OK...here is what I try to do..
This is what I try to do...
When a user login on the web page, I can locate which city (even the exac location) of this user. So the user can explorer the nearby product around this user.
I need to show the location and other products' location on a map; hence, I would love to have a google map on my web page. Also, there will be more functions in Java program, then, I want to figure how I can get the information of the user's location.
Not sure whether this information is enough...
Still trying to work on the tips above...
have a look here http://www.javascriptkit.c
I tried to copy and paste the codes in the link aboved...and I kept having some error messages on the following line..
var mygetrequest=new ajaxRequest()
mygetrequest.onreadystatec
if (mygetrequest.readyState==
document.getElementById("r
}
} <-- error message here...said need an object
Any idea what's wrong?
In case there may be some confusion the AJAX code recently posted (see http:#a24783401) is not an API. It isn't Google's either. I am actually not really sure why it is needed. You need these results in your Java code, right? Have you tried just a basic test (i.e. a Google Search API) to see if your Java will get the response? I wouldn't spend lots of time on details of this until you verify the basics will work. Because of the way the Google API works I am afraid you won't be able to use it like you want.
This was mentioned earlier but you do know the ClientLocation results may not work and aren't very specific? I just mention this because if you have to always get a location or need it to be more accurate than it is designed then you might as well stop now. Google's Client Location does have some limitations.
Let me know if you have a question or need more info.
bol
If you have a Google Maps API key set up try using the code below. It uses Javascript and loads the Maps API to then get CurrentLocation. It is the basic way to get the location (if the script can get it). Keep in mind loading any of the Google APIs should make it so you can use the CurrentLocation code. This uses Maps because it is a common use and simple example but you don't have to have a map on your page, etc.
Let me know if you have a question or how this works. If you need help using it then let us know.
bol
p.s. Don't forget to enter your key in the first script tag where you see "YOURKEYHERE".
So does the page I provided work now just as an html page opened up in your browser? Make sure you are testing it from your domain or as a "localhost" site. If it does work then great. Let me know if you need anything else as far as an html page that will do this.
>> so now I need to use POST/GET to communicate with my server program (in java)? <<
Isn't that back to what you decide to drop because it wasn't going to work? Don't really understand what you mean and it seems like that is a line you said earlier about stuff you now know won't give the result you wanted. Let me know if you think I have misread this. Also if you are asking for help with that then please be more specific. The sentence seems like a statement except it ends with a question mark. I am not real sure what the question is.
bol
xenia27, why did you mark http:#24782809 as the accepted answer? It's not relevant to your requirement and is an approach you correctly rejected ...
Business Accounts
Answer for Membership
by: CEHJPosted on 2009-07-03 at 01:07:31ID: 24770733
>>So, I tried to call through Java
How? Please post code