File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to read specific data from a web page..

 
saikrishna cinux
Ranch Hand
Posts: 689
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to develop a midlet which can read specific data from a web page..

any suggestions please...
thanx in advance

cinux
 
Mark Spritzler
ranger
Sheriff
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
saikrishna cinux
Ranch Hand
Posts: 689
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 88
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may use following code as a starting point too:

How to download an image from a web server
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic