aspose file tools*
The moose likes JSP and the fly likes code not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "code not working" Watch "code not working" New topic
Author

code not working

alec stewart stewart
Ranch Hand

Joined: Dec 23, 2003
Posts: 71
the following line of code is not working
<%
Runtime.getRuntime().exec("word.js");
%>
the code for word.js is:
var objShell=WScript.CreateObject("WScript.Shell");
var objWord=WScript.CreateObject("Word.Application");
var objDoc=objWord.Documents.Add();
objWord.visible=true;

Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
I think you are getting a bit confused between whet happens on the server (where your web application and the servlet container are located) and on the client (the machine running the browser).
All the Java code that you run as part of a JSP (such as calling runtime.exec() ) happens on the server, as the page is being generated - before it is sent to the browser. I'm guessing that you actually want to run this javascript code in the browser, which is located on the client machine.
The easiest way to do this is to just print the Javascript statements to the JSP page, so that the browser will run them when it receives the page:
mypage.jsp:

Is that more like what you are looking for?


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: code not working