I am looking for the easiest way to access a Java API on a webpage. So the webpage can display information from the Java API. Any ideas? Greatly appreciated.
You will need to make an ajax call back to the server to load a java script Java is run on the server Javascript is run on the webpage
ok, so how do you interface with the java from the javascript? You have an example or something? I have put a lot of research into this. Hours, have not been able to get this done.
You build a script using java and then call it from the ajax script the same way you would a .php or .asp page. Do you have your script in Java written? tested?
Yes - there are still a few updates down the line which will need to be made. but I'm wondering how you call a java api from ajax... I just did some more research on it. and came across this resource which seems incredibly informative. http://javapapers.com/ajax/getting-started-with-ajax-using-java/
That article was overly complicated since people rarely use raw ajax and instead use a library like prototype or jquery. The guts of it though was that it called a java script - in this case "helloworld.java" and that is what you are trying to do. Have you written your java script yet? or is your real problem that you don't have access to the server running java?
The java part is partially written, like I can compile it down to a class file as is to test right now. I just don't to put hours into dev right now with out knowing this will work for sure. I can test it right now - I am just figuring out how to set up the servlet on tomcat, then figuring out how to make requests to the servlet. What do you mean by "is your real problem that you don't have access to the server running java?" - If this means what I think it does...my problem is I don't actually know how to make the connection between the ajax/jquery and java servlet.
Lets start over. Can you explain what you are trying to do. Back in the old days the flow was this the browser requests a web page the server finds the file which generates the page. If it's .html then it just returns that file, if it's .php, .asp etc then it executes the script which in turn may call more scripts. They all, however, return plain text which is read by the browser. The browser receives the plain text and reads it and decides if that text is a web page, an xml feed, an image, a flash file etc and shows it to the user Nowadays with ajax we can add a 4th step the user interacts with a webpage and a) requests a new page; or b) sends an ajax command back to the server From your initial question I thought you were at the 4th step where the page had been shown to the user and you needed a small command to be back to the ajax server and return with some extra html etc. I'm now wondering if you are really back at step 1 trying to get a page loaded.