Stock servlet ver. 1.1

This servlet lets you request stock quotes from Yahoo and return them as JSON array.

How to use it:

a) download stockPackage.jar and save it in WEB-INF/lib

b) describe this servlet in web.xml file.


c) describe a mapping for this servlet in web.xml file. E.g.:


Servlet accepts two parameters:

q - commas separated list of tickets
callback - optional parameter. Describes a name for your JavaScript callback

    The following example illustrates the usage. This code requests info about ORACLE stock. JavaScript function f describes our callback.

<script language="JavaScript">

function f(info)
  var s="Symbol:" + info[0].symbol+"\n"
   +"Name:" + info[0].name+"\n"
   +"Price:" + info[0].price;


var e = document.createElement("script");
e.src = 'http://your_server/servlet/stock?q=ORCL&callback=f';


   For downloading:

    Stock package:  stockPackage.jar

 ©  Coldbeans     Comments?

See also JSOS - the largest collection of servlets and filters.

Also in JSOS: