JSP and FileOutputStream

Hi

I have done some simple form for inserting some data into input fields...

this input fields are inclosed into form tag... and action="AnotherJSP.jsp"

in this AnotherJSP.jsp i create java object...

this object prints data to my matrix printer (to print data i use

FileOutputStream v_out = new FileOutputStream("\\\\ip_of_hostprinter\\printername");

v_out.write(somedata);

...)

i have to do this that way because im using escape sequences for my matrix printer...

now when i create this class (with FileOutputStream inside) in

public static void main(String[] args) ..., it works.. it prints...

when i create this class (with FileOutputStream inside) in my JSP it outputs some error :

java.io.FileNotFoundException: \\ip_of_hostprinter\printername (Access is denied)

at java.io.FileOutputStream.open(Native Method)

at java.io.FileOutputStream.<init>(Unknown Source)

at java.io.FileOutputStream.<init>(Unknown Source)

at Printing.Printing.initPrinter(Printing.java:76)

at Printing.Printing.<init>(Printing.java:68)

at org.apache.jsp.printPage_jsp._jspService(printPage_jsp.java:57)

at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)

at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)

at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)

at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:833)

at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:639)

at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1285)

at java.lang.Thread.run(Unknown Source)

and then ofcourse NULLpointerexception... because there is no v_out...

i wander why it work (from the same computer) if i call printing from main and does not work if i call (from the same comp.) from jsp...

?!?!!

any ideas?

[3000 byte] By [zmedaa] at [2007-11-26 15:20:59]
# 1
I have looked around a little and saw that $CATALINA_HOME\conf\catalina.policy includes samo permissions and stuff like that...so i dont know do i need to set right permission or what?
zmedaa at 2007-7-8 11:49:24 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
One more thing... that might be helpfullllllif i try like thisFileOutputSteam v_out = new FileOutputStream("c:\\temp\\test.txt");...it works eather called with jsp or in main...thx
zmedaa at 2007-7-8 11:49:24 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...