We're designing a Java EE web app (to run on tomcat)
It's intended to be a web interface for a command line program. Is there any framework/application that allows this?
i.e. JSP pages which will internally fire commands to a program installed on the same server as the Tomcat server.
The command line is a 开发者_Python百科propietary non-Java program.
You can use java.lang.Runtime
and its exec(..)
methods to start command-line programs.
You can make your own, its pretty simple,
capture command from jsp,And execute it on server using
Runtime.getRuntime().exec(commands);
and send back the response
Be aware that your security manager will probably restrict the use of Runtime.exec() inside of your application server...
I've found this article to be invaluable when using .exec
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
It has quite a lot of good example code, and shows many of the pitfalls.
精彩评论