---------------------------------------------------------------------------
HARBOR: http://coolharbor.100free.com/index.htm
Now Tomcat is also a cool pojo application server
---------------------------------------------------------------------------
----- Original Message ----- From: "Rocco Scappatura" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Tuesday, November 06, 2007 9:17 AM
Subject: Re: Problems with a web application running a PHP script



Thanks for you hints. I will disinstall all JDK/JRE versions from my PC.
I'm dowloading JDK 6 Update 3 and I will install it.

No problem, you got me curious about scripting...
I Tested with this
======================================
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
           throws ServletException, IOException {
       response.setContentType("text/html;charset=UTF-8");
       PrintWriter out = response.getWriter();


       out.println("<html>");
       out.println("<head>");
       out.println("<title>Servlet NewServlet</title>");
       out.println("</head>");
       out.println("<body>");
       out.println();
       out.println("<p>Stand Back... Script running</p>");

     ScriptEngineManager scriptMgr = new ScriptEngineManager();
     ScriptEngine jsEngine = scriptMgr.getEngineByName("JavaScript");
     try {
       jsEngine.eval("var meJavaScript = 'Me-Java Script!';");
       out.println("<p>" + jsEngine.get("meJavaScript") + "</p>");
     }
     catch (ScriptException ex) {
out.println("<p>Oh Damn! Script Crashed " + ex.getMessage() + "</p>");
       ex.printStackTrace();
     }

       out.println("</body>");
       out.println("</html>");
       out.close();
   }

=======================================

Hey it works....
But in the process I discovered a few things....

+ Even if TC is installed on 1.5..... if NB is using 1.6 and its run from the DEV enviroment... it will make TC use 1.6
So... thats probably whats happening to you.
Its easy to check because in NB system out it tells you which JRE is used.
And when you start TC from the BAT it will tell you... as well... in your case probably 1.5

+ The Source level makes no difference in a servlet.... ie if the JRE is 1.6, you cant bring it down, this is different to normal Java Programs that will do things like tell you it now doesnt understand a template... but in servlets it seems to ignore that.

Anyway it works....
Quite neat.... the scripting thing....
May even be the beginning of a new chapter in TC.... there are always guys saying... "can TC run PHP", I see one can even run stuff like JavaFX
Thank u



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to