aspose file tools*
The moose likes Java Micro Edition and the fly likes how to read specific data from a web page.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "how to read specific data from a web page.." Watch "how to read specific data from a web page.." New topic
Author

how to read specific data from a web page..

saikrishna cinux
Ranch Hand

Joined: Apr 16, 2005
Posts: 689
i want to develop a midlet which can read specific data from a web page..

any suggestions please...
thanx in advance

cinux


A = HARDWORK B = LUCK/FATE If C=(A+B) then C=SUCCESSFUL IN LIFE else C=FAILURE IN LIFE
SCJP 1.4
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Is this a web page that already exists that you didn't create. If so, then you will have to write code that parses the HTML and get the data you would like.

Or you can create your own Servlet, that your MIDlet calls, in which the Servlet does the call to the outside Web Page, and parses it on behalf of the MIDlet, and just send back the needed text to the MIDlet.

Otherwise, I would suggest creating a seperate Servlet for you to call that will only pass back the specific text that you want. Or if you don't have Servlets, then create a new "html" page that will just be text that sends back the information that you want.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
saikrishna cinux
Ranch Hand

Joined: Apr 16, 2005
Posts: 689
yes, i want to create a servelt which can read the data from the html page and hand it over to the midlet..
but how???
Alfredo Estrada
Greenhorn

Joined: Jan 07, 2006
Posts: 4
Dear saikrishna cinux:

the way to read "bytes" a URL connection is next pseudocode:

1- Connect to URL
2- Open InputStream
3- Read bytes and store into ByteArrayOutputStream
4- Close the InputStream
5- Get the byte[] from the ByteArrayOutputStream, and process !
6- Notify to other Main Class( like work as Listener) (e.g. using static boolean flags) that the connection has done.

*7 If any error ocurrs, must do some like step 6. but specifing the reason of error.

these steps shuld be in a separated Thread, the body of run method.
Casper Maxwell
Ranch Hand

Joined: Aug 04, 2005
Posts: 88
You may use following code as a starting point too:

How to download an image from a web server
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to read specific data from a web page..