在jsp页面上输出perl脚本



我正试图将perl脚本的输出直接打印在jsp页面上。我一直在我的jsp页面上尝试不同版本的此行:

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:import url="script.pl" />

我已经在项目目录中放了一个脚本但不断出现此错误:Servlet jsp的Servlet.service()引发异常java.io.FileNotFoundException:directories.pl(没有这样的文件或目录)

那么,我应该把我的脚本放在哪里,以及如何将它的输出打印到jsp页面?感谢

我最终以不同的方式做到了这一点。这对我来说更好,因为我想处理我接收的数据,并将其放在页面的表中

    try {
        Runtime r = Runtime.getRuntime();                    
        Process p = r.exec("/actualdirforscript/scripts/ls.pl");
        BufferedReader in =
            new BufferedReader(new InputStreamReader(p.getInputStream()));
        String inputLine;
        while ((inputLine = in.readLine()) != null) {
              out.print(inputLine);
        } 
        in.close();
    } catch (IOException e) {
        System.out.println(e);
    }

最新更新