jsp調用Python


真是神奇,在我為python可視化的圖表在jsp頁面中不能動態更新的時候,老師告訴我也許能直接調用,竟然還有這種操作!!!

百度一下,再應用一下,真的成功了!

害怕!

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import = "java.io.BufferedReader" %>
<%@ page import = "java.io.InputStreamReader" %>


<%
    Process proc = Runtime.getRuntime().exec("python C:\\Python\\ex3.py");
    BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));  
    String line;  
    while ((line = in.readLine()) != null) {  
        out.println(line);  
    }  
    in.close();      
    proc.waitFor();   
    out.println("end");
%>

 

學無止境啊!


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM