• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

code not working

 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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;

 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
They weren't very bright, but they were very, very big. Ad contrast:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic