Presentation is loading. Please wait.

Presentation is loading. Please wait.

Hints for Assignment #8. Initial Screen Hints for the initial page You need a DOCTYPE with the proper namespaces defined You need to import the facebook.

Similar presentations


Presentation on theme: "Hints for Assignment #8. Initial Screen Hints for the initial page You need a DOCTYPE with the proper namespaces defined You need to import the facebook."— Presentation transcript:

1 Hints for Assignment #8

2 Initial Screen

3 Hints for the initial page You need a DOCTYPE with the proper namespaces defined You need to import the facebook api http://connect.facebook.net/en_US/all.js You need to create the XMLHttpRequest object as shown in class You need to set up the call to your Java servlet, e.g. req.open("GET", "http://csci571.usc.edu:PORTNO/examples/servlet/MyServlet?args", true); You need to set up the routine that gets called when the servlet returns data, e.g. req.onreadystatechange = processReqChange; The servlet returns JSON data; you need to evaluate the string and then build a table with three rows of stock results; remember to include a last column of radio buttons Then create a button, e.g. BUTTON.innerHTML += " "; When the button is clicked call the Facebook routine to create the prompt and login to Facebook, e.g. FB.ui( { method: ‘stream.publish’, message: ‘Current stock quote’, AND OTHER ARGUMENTS )

4 Outline of the Java Servlet Various java library imports public class MyServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); String feedURLString = request.getParameter("feedURL"); String script =""; initialize JSON objects try { StringTokenizer st = new StringTokenizer(feedURLString); while (st.hasMoreTokens()) { read the three stock symbols } Call you modified Perl script from assignment #6 which creates an XML output file URL url = new URL("http://cs-server.usc.edu:37547/cgi-bin/account.pl"); Read the XML output file created by the Perl Script Convert the XML output into JSON output Return the result to your web page where a JavaScript function processes the JSON


Download ppt "Hints for Assignment #8. Initial Screen Hints for the initial page You need a DOCTYPE with the proper namespaces defined You need to import the facebook."

Similar presentations


Ads by Google