By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,542 Members | 1,097 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,542 IT Pros & Developers. It's quick & easy.

problem with R/W operations for File in java.i'm using in jsp.

P: 28
Hi to all!!!!!
Please help Me!!

I am having a web page which consists of three inter related windows(iframes).

1)For typing the msg to be send.(iframe1)
2)To display that msg along with the previously sent messages(append).These must be appered as hyperlinks.(iframe2)
3)Onclicking a hyper link you must get that message (hyperlink) or even that msg as first msg.i.e, similar to hyper links with in same page.(iframe3)

What i done is:

when a msg is sent(submit), i stored it in a file(msg.txt) as hyperlinks and the form action is set to a jsp file that writes in to a file and used <include> tag in the same jsp file to display that file(msg.txt) in iframe2.When i click a hyper link in the iframe 2 it is displayed in iframe3 as first msg.

Problem over here:

When i clicked the send button the msg is not reflected. It is reflected only when i open the file msg.txt and send some other msg. that to only the previous msg not the currently sent one. I used reload but no use. I think the problem is with writing in to a file.

file R/W code:
File file = new File(path);
Writer wr = new BufferWriter(new FileWriter(file, true));
writer.write(m);
writer.flush();
writer.close();

Please help me to avoid this or suggest some other way to implement it.
Thanks in advance.
Dec 14 '06 #1
Share this Question
Share on Google+
1 Reply


b1randon
Expert 100+
P: 171
Hi to all!!!!!
Please help Me!!

I am having a web page which consists of three inter related windows(iframes).

1)For typing the msg to be send.(iframe1)
2)To display that msg along with the previously sent messages(append).These must be appered as hyperlinks.(iframe2)
3)Onclicking a hyper link you must get that message (hyperlink) or even that msg as first msg.i.e, similar to hyper links with in same page.(iframe3)

What i done is:

when a msg is sent(submit), i stored it in a file(msg.txt) as hyperlinks and the form action is set to a jsp file that writes in to a file and used <include> tag in the same jsp file to display that file(msg.txt) in iframe2.When i click a hyper link in the iframe 2 it is displayed in iframe3 as first msg.

Problem over here:

When i clicked the send button the msg is not reflected. It is reflected only when i open the file msg.txt and send some other msg. that to only the previous msg not the currently sent one. I used reload but no use. I think the problem is with writing in to a file.

file R/W code:
File file = new File(path);
Writer wr = new BufferWriter(new FileWriter(file, true));
writer.write(m);
writer.flush();
writer.close();

Please help me to avoid this or suggest some other way to implement it.
Thanks in advance.

Java is not the same as javascript. Javascript is client-side. Java is a server-side language. You need to move this to a thread that is related to Java if you want to get some help.
Dec 14 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.