O'Reilly logo

Java™ After Hours: 10 Projects You'll Never Do at Work by Steven Holzner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating the Forecaster JSP

In this project, the first task is to get the user's ZIP Code. You're going to need the ZIP Code in order to get the National Weather Service's high and low temperature forecasts, so that's the first order of business. After getting that ZIP Code, the code will concentrate on getting the forecast and graphing it.

Getting the ZIP Code

In the JSP, there are two ways to get the ZIP Code. First, you can supply a ZIP Code as part of the URL encoded as ?zip=nnnnn, this way, which sets the URL to 94707:

http://www.yourjsphost/username/forecast.jsp?zip=94707

This way is handy in case you want to embed the JPEG image this JSP creates in a web page, as you see in Figure 10.1. You can use the URL to the JSP, with the encoded ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required