showing text from a file in an applet

i'm trying to build a very simple chatbox and i've succeeded to make one in Active Server Pages. Only problem is that it has to reload, and at this moment all the content disappears and a new page is displayed (just loading a document with a <meta refresh>-tag.

I;ve understood that it is possible to let an applet load a text file (which i generate with ASP) and display it. The applet itself can ask that .asp-document every x seconds and display the text without blinking.

The text consists of 3 parts:

- a url
- the name of the author (in bold)
- the bodytext, stripped from html


http://< jesse - hello people, how are you?

is it hard to make an applet which displays this info? Can anyone make the body of it for me and how many points would you like to have?

greets, Jesse
Who is Participating?
Ravindra76Connect With a Mentor Commented:

HI ,

URL url = new URL("http://"+getCodeBase().getHost()+"/yourfile.asp");

InputStream in = url.openStream();
BufferedReader br = new BufferedReader(new InputStreamReader(in));

if ( br != null ) {
String url = br.readLine();
String author = br.readLine();

while ( true ) {
 Stirng line = br.readLine();
 if ( line == null ) break;
 // THis is all your text file.

where ta is java TextArea.

I hope, U understand the key logic.
That's the power of URL in java

Best of luck

heitAuthor Commented:
the url points to another script, which should only be executed, not shown, and the tag on which one can click is just a smaller-than-sign (<)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.