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 http://google.com. I am also printing some values set in the HTTPConnection as given below-
host : google.com
url: http://google.com port: 80
content type: text/html; charset=UTF-8
got content type: text/html; charset=UTF-8
total bytes read: 1391
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)
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.
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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: HTTPConnection MIDlet in Ch.7 of SCMAD Exam guide