O'Reilly logo

XML and Java™ from scratch by Nicholas Chase

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

Adapting a Servlet for Wireless Devices

In the Browser Detection and Media sections of this chapter, we looked at using different style sheets for different types of browsers. Now we're going to take that a step farther, creating a new style sheet for our Web phone.

Before we can even think about seeing it, however, we need to make a couple of changes. First of all, as we mentioned earlier, the phone isn't going to understand any requests that come back with a MIME-type other than text/vnd.wap.wml. So, the first thing we need to do is to tell the servlet to output the appropriate MIME-type. In Listing 9.17, we'll use the media value, which we're already checking for, to decide on the appropriate MIME-type.

Listing 9.17. ShowCatalog.java: Adjusting ...

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