This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Learning about programming web applications Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Learning about programming web applications" Watch "Learning about programming web applications" New topic
Author

Learning about programming web applications

amk pitt
Greenhorn

Joined: Sep 12, 2013
Posts: 3
Hey guys,

This is my first post here. I am currently a student who is studying cs. I have a good handle on java and am learning C, but still have plenty more to learn. One thing I am interested in learning is how to write a program that interacts with information on the web. Take this as an example:


Write a small application that lets a user input their email and a desired product (productId or productName) and sends them an email when the price hits at least 20% off the original price.


I have no experience with writing code that can extract information from the web. I have only done things that either read in user input or read information from a text file. I essentially have no idea how I would go about interacting with the web. I was wondering if anyone who knows how to do this could give me a good starting point for learning how to do this. I understand thats a broad question, but I'm really ignorant on the subject. Can I use Java? Do you have any links for tutorials that would be useful? Any advice would be greatly appreciated.

Thanks.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

I don't see why you think that "interacting with the web" is part of the solution for that question.

But that's mostly because the specifications are incomplete. For example: where is the data for those products stored? Are you supposed to arrange that storage yourself, or is the data already somewhere and you're just supposed to access it?
amk pitt
Greenhorn

Joined: Sep 12, 2013
Posts: 3
I figured since all the user was inputting was his email and product name, that I would have to have my program search for the product's lowest price on the web, and then alert the user once that product is available somewhere on the web for 20% less. Perhaps that is more than the assignment is asking, but assuming I wanted to do this, I would have to access the web. Assume this is the type of problem I want to be able to tackle.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60803
    
  65

"On the web" is pretty broad. Exactly where do intend to get the information from? A web service? Screen-scraping a web page? Other?

Part of learning to program is learning how to specify problems. You'll need to be much more complete.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
amk pitt
Greenhorn

Joined: Sep 12, 2013
Posts: 3
Bear Bibeault wrote:"On the web" is pretty broad. Exactly where do intend to get the information from? A web service? Screen-scraping a web page? Other?

Part of learning to program is learning how to specify problems. You'll need to be much more complete.


Ok I see. I guess I would use a Screen-scraping method. I guess thats one place i should start. Thanks Bear.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60803
    
  65

To fetch things from the web, check out the classes in the java.net package; especially URLConnection.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
Screen scraping is a LOT more complex now than in the old days of "terminal" displays. Where a terminal display was once created from a single stream of characters, a modern web page may be built from dozens of different resources.

Bill
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Don't forget that once you have the screen-scraping part working, all that gives you is the current price for the item. You also need somewhere to store the user's e-mail address and the price of the item at the time the user made the request, so that when three weeks later you find a new price which is 20% lower, you'll be able to send that long-awaited e-mail.
 
 
subject: Learning about programming web applications
 
Similar Threads
IS JAVA THE RIGHT LANGUAGE?
A rather long post of me talking gibberish and asking lots of questions
How to create a web application.
Java or... dilemma of a poor newbie
Input/Output Question...