how to wrap an existing java application into a servelet?
Assume that I have a java file, how can I wrap it into a serverlet? Is there any tutorial or procedure that 开发者_JAVA百科I can follow?
Well, at that level of detail, no.
What does your java program do? If it's a GUI program, you're more or less out of luck -- a servlet is essentially text based.
If it's a text based program that just generates output, you can probably hack together a way to load the application and run the appropriate static main.
Even then, the truth is that the servlet model, based on being a web application, is a pretty different environment -- you may be able to reuse parts of your java application but have to rewrite a substantial bit to make it work.
Define "wrap".
If you are new to this, the Oracle Servlet Tuutorial is a good place to start: http://download.oracle.com/docs/cd/E19159-01/819-3669/6n5sg7avg/index.html
精彩评论