• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Creating file and writing errors to it, not successful

 
Sean Cormican
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried using the code within a java class to test it and it works fine but it will not work correctly and issues no warning when used inside a JSP am I missing something
the file itself is not even created ? e.g. output.txt


username bug bugCode bugError
are all variables containing information from the database

Does anybody have any thoughts ?

Thanks in advance !
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64990
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why on earth would you move working code out of a Java class and into a JSP?

Putting Java code into a JSP is a very poor practice that has been discredited for 10 years now. Leave the code in the Java class where it belongs.
 
William P O'Sullivan
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to understand how JSPs are compiled and executed.
For example, Logout.jsp:

Becomes; Logout_jsp.java (in <server>/work/jboss.web/localhost/_/org/apache/jsp

Big difference eh? Since you have no folder or directory on your new FileWriter("output.txt", true) code, where do you think the file is going to be created at run-time?

JSPs do no execute at all, not ever. They are converted at run-time to pure Java in a temporary location (depending on web server and run from there).

Pat.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic