Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Onclick=window.open('MyFile.html','NewWindow')

843835Feb 19 2002 — edited Feb 20 2002
Friends I am having problems with this java script statement.

What I am doing in my JSP page is that first I make the user to enter some data and then on clicking a CREATE button I create a HTML file (based on data entered ) using FileWriter class ,and then on clicking VIEW button I use the Onclick statement to open the created file.

But every time I CREATE and VIEW the file ,the Onclick opens the first file that my program has created !!

Is there any mystery behind it ?

I tried to debug it



important piece of code
------------
//3 SUBMIT BUTTON
out.println("<TABLE ALIGN = CENTER>");
out.println("<TR>");
out.println("<TD>");
out.println("<INPUT TYPE = 'SUBMIT' Name = 'CreateButton' value ='Create File'>");
out.println("</INPUT>");
out.println("</TD>");
out.println("<TD>");
out.println("<INPUT TYPE = 'SUBMIT' Name = 'ViewButton' value ='View the latest created file' Onclick=window.open('/TabularListReport.html','NewWindow')>");
out.println("</INPUT>");
out.println("</TD>");
out.println("<TD>");
out.println("<INPUT TYPE = 'SUBMIT' NAME ='ExitButton' value ='Exit'>");
out.println("</INPUT>");
out.println("</TD>");
out.println("</TR>");
out.println("</TABLE>");


--------------------------------------------------


if (CM.CreateReport == true)
{
FileWriter FW = new FileWriter("/TabularListReport.html");
PrintWriter PW = new PrintWriter(FW);

PW.println("1");
PW.println("2");
PW.println("3");
PW.println("4");
PW.close();
FW.close();

------------------


Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 20 2002
Added on Feb 19 2002
4 comments
191 views