Hi all, where can I find a free area that can let me place jsp into? if any, please tell me cause I am poor in set up server to run jsp ... but I still want to try how to write jsp ^^ thank a lots. Jason ----- Original Message ----- From: Andrew Bruno <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, August 29, 2001 9:39 AM Subject: Re: Error: JSP Page threw a non-Exception Throwable???? > Hi Celeste, > > I wanted to test out the runtime feature, so I set out to test it on > Tomcat 4b6, win 2000 server. > > I created a bat file called hello.bat that simply echoed hello into a > hello.txt file. I dont have the printer LWPPrint, and I dont know how > to print from dos command prompt. > > The code is very similar to yours, except that I have put the Print > method inside a main Utils class, and packaged it due to my environemnt > setup. The other difference is that the hello.bat file returns very > quickly, and I do not know how to put a timer in the DOS batch files in > order to test the wait feature. The other difference is since I dont > have the writer.* log feature, I simply used e.printStackTrace methods > instead. > > It seems to work fine. Below is the code: > > ************** Start Utils.java > package andrewbruno; > > import java.io.*; > > public class Utils { > > public int Print() { > Runtime rt = Runtime.getRuntime(); > Process proc; > > try { > proc = rt.exec("F:\\myWork\\bin\\hello.bat"); > } catch (IOException e) { > e.printStackTrace(); > file://("--* exec failed: error " + e.getMessage()); > return (-1); > } > > int exitStatus = -1000000; > > do { > try { > exitStatus = proc.waitFor(); > } catch (InterruptedException e) { > file://writer.writeDebug("wait interrupted " > + e.getMessage()); > e.printStackTrace(); > } > } while (exitStatus == -1000000); > > return (exitStatus); > }//end Print > > }//end Utils > ************** End Utils.java > > ************** Start JSP file > > <jsp:useBean id="test" scope="session" class="andrewbruno.Utils"/> > > <% > int yes = test.Print(); > if ( yes == (-1) ) { %> > <H1> Error occurred trying to execute LMWPrint</H1> > <%} else %> > <h1>Automation of LMWPrint completed</h1> > > ************** End JSP file > > I am happy to expand on the above if you'd like me to test any thing > else. > > Thanks for your code example ;) > >:ab > > > -----Original Message----- > From: Haseltine, Celeste [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, 29 August 2001 9:21 AM > To: [EMAIL PROTECTED] > Subject: Error: JSP Page threw a non-Exception Throwable???? > > > Has anyone every experienced the following exception from a JSP: > > Exception javax.servlet.ServletException: JSP Page threw a non-Exception > Throwable. > > I am trying to access a method in a Java class bean called Print from > within > my JSP. The Print method resides in a Java class bean (non-visual) that > contains the following code : > > public int Print() > { > Runtime rt = Runtime.getRuntime(); > Process proc; > > try { > proc = rt.exec("LMWPrint /L=C:\\Program > Files\\lmw3\\LabelFiles\\thirty.qdf /P=2"); > } catch (IOException e) { > writer.writeDebug("--* exec failed: error " + > e.getMessage()); > return (-1); > } > int exitStatus = -1000000; > > do { > try { > > exitStatus = proc.waitFor(); > } catch (InterruptedException e) { > writer.writeDebug("wait interrupted " + > e.getMessage()); > } > } while (exitStatus == -1000000); > > return (exitStatus); > }//end Print > > The Print method launches another executable called LMWPrint.exe, which > resides on the same machine as my JSP, Java class bean code and JRUN > Server. > Can you NOT start another executable on the same machine from a call > within > a JSP to a method in a JavaBean? If I run the JavaBean as a stand alone > Java class, the Print method works, and spawns off another process that > opens LMWPrint.exe. But when I call the Print method from a JSP as > follows: > > <jsp:useBean id="Test" scope="session" class="TestProcess"/> > > <% > int yes = Test.Print(); > if ( yes == (-1) ) {%> > <H1>Error occurred trying to execute LMWPrint</H1> > <%} else %> > <h1>Automation of LMWPrint completed</h1> > > I get the above error message. > > Anyone have an ideas/suggestions? > > Celeste > > ======================================================================== > === > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff > JSP-INTEREST". > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST > DIGEST". > Some relevant FAQs on JSP/Servlets can be found at: > > http://java.sun.com/products/jsp/faq.html > http://www.esperanto.org.nz/jsp/jspfaq.html > http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP > http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets > > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". > Some relevant FAQs on JSP/Servlets can be found at: > > http://java.sun.com/products/jsp/faq.html > http://www.esperanto.org.nz/jsp/jspfaq.html > http://www.jguru.com/jguru/faq/faqpage.jsp?name http://www.jguru.com/jguru/faq/faqpage.jsp?name > =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets