Hey!
This is basically not a servlet question. But in the interest of
keeping the noise down, I offer this crumb.
Some things to get you started.
1) Study the RFC for page request. Search this archive for the RFC number.
http://archives.java.sun.com/archives/servlet-interest.html ;
I don't remember the number.
2) Open a URL connection to the website. See the JDK docs.
3) Send a request with the appropriate request header. Receive the
HTML document in a stream.
4) Parse the stream to find the stock quote of concern. Do you 'thingy"
with it.
5) "Send an alert"? If you mean by that, an E-mail, then build and send
an E-mail with sun.smtpClient (see Jason Hunter's book) or JavaMail
(see sun's website).
#2. Do you really want to do this? I think this is a bad idea.
If any of this seems foreign to you, then you need to do some studying.
Now what was your SERVLET-INTEREST question? :>)
Sans adieu,
Danny
Kronos B wrote:
> Hi,
> This question might be really basic, but I just 2 weeks old as a servlet
> developer.
>
> I have written a servlet which serves as a stock quote wrapper, ie, if you
> type a stock ticker, say MSFT in the box provided, the servlet sends the
> request to yahoo-finance, and gets the results. This servlet is doing
> nothing terrific...the same thing can be done by going to Yahoo-finance
> directly!
>
> However, I want this servlet to go to that yahoo-finance page, extract
> that specific stock quote, compare it with a threshold value, and generate
> an alert if the stock has fallen below the threshold.
>
> So I need to know two things: How to extract HTML from the Yahoo-finance
> page using a servlet?<Then I will parse it to get the stock quote>
>
> #2 How do I make this servlet repeat the stuff every 1 minute(say) to
> constantly keep monitoring the stock? <will a 'C' style loop, like
> while(1) do?>
>
> I *really* appreciate your help in this regard!
>
> Thanks in advance!
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html