File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Product and Other Certifications and the fly likes HTTPConnection MIDlet in Ch.7 of SCMAD Exam guide Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Product and Other Certifications
Bookmark "HTTPConnection MIDlet in Ch.7 of SCMAD Exam guide" Watch "HTTPConnection MIDlet in Ch.7 of SCMAD Exam guide" New topic

HTTPConnection MIDlet in Ch.7 of SCMAD Exam guide

Jane Joseph
Ranch Hand

Joined: Feb 21, 2008
Posts: 39
Hi Sathya, Ko Ko

I'm executing the HTTP Connection (Listing 7.1) from the book on Nokia S40 emulator. On Launching the MIDlet get the message, "HTTPMIDlet running. Nothing to display". The url I'm using is I am also printing some values set in the HTTPConnection as given below-
lastModified: 0
host :
encoding: null
port: 80
content type: text/html; charset=UTF-8
got content type: text/html; charset=UTF-8
total bytes read: 1391
got data:[B@d590dbc

Is this output as expected? Probably it would open the web page while running on the actual device. (Currently do not have an S40 device handy)


Sathya Srinivasan
Ranch Hand

Joined: Jan 29, 2002
Posts: 379

The connection and messaging examples provided in the book are to show how to use the API and aren't really full applications. In this case, you are getting the "Nothing to display" message because no screen instance is instantiated and associated with the Display within the MIDlet. In essence, this MIDlet has no user interface, and hence the message.

Also, the MIDlet by itself does not act as a browser and hence getting the HTTP data doesn't mean it can be displayed. A more practical scenario working on the same example would be if you have an RSS feed in a website, you can get the contents of the feed, parse the XML, and display it in a way you want to.

So, the result you saw was expected.

Cheers, Sathya Srinivasan - SCJP 1.2, SCWCD 1.2, SCMAD 1.0
Co-Author of Whizlabs SCMAD Certification Exam Simulator and SCMAD Exam Guide Book
Jane Joseph
Ranch Hand

Joined: Feb 21, 2008
Posts: 39
Thanks for your explanation.

I believe google website has a RSS feed. Though I do not know much about getting the contents, parsing the XML and displaying it on my UI on mobile. Am looking up for some info on the same. By chance you have some links/tutorials for the same, I'll be glad if you could share it.

I agree. Here's the link:
subject: HTTPConnection MIDlet in Ch.7 of SCMAD Exam guide
jQuery in Action, 3rd edition