Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/402.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 将数组中的调用文件从PHP转换为JSP_Java_Php_Jsp - Fatal编程技术网

Java 将数组中的调用文件从PHP转换为JSP

Java 将数组中的调用文件从PHP转换为JSP,java,php,jsp,Java,Php,Jsp,我是新学JSP的,以前我会PHP 我想把这个脚本PHP转换成脚本JSP。 我想在JSP中创建动态文件 创建index.jsp的示例 header.jsp dynamicfile.php footer.php <% String pages_dir = "pages"; String pages; String p = request.getParameter("p");

我是新学JSP的,以前我会PHP

我想把这个脚本PHP转换成脚本JSP。 我想在JSP中创建动态文件

创建index.jsp的示例

header.jsp

    dynamicfile.php

footer.php
<%
                String  pages_dir = "pages";
                String  pages;
                String  p = request.getParameter("p");

                 if(!empty(p))
                     pages = java.io.File dir = new java.io.File(pages_dir,0);

                String wew = p+".jsp";
                List nameList = Arrays.asList(wew);

            %>
这个动态文件调用类似于index.jsp?p=about

这是“pages/about.jsp”中的about文件

这是剧本

<?php $pages_dir = 'pages';
if(!empty($_GET['p'])){
$pages = scandir($pages_dir, 0);
unset($pages[0], $pages[1]);

$p = $_GET['p'];
if(in_array($p.'.php', $pages)){
include($pages_dir.'/'.$p.'.php');
} else { ?>
<meta http-equiv="refresh" content="0; url=404.html" />
<?php }
} else {
include($pages_dir.'/beranda.php');
} ?>

这是我的脚本index.jsp

header.jsp

    dynamicfile.php

footer.php
<%
                String  pages_dir = "pages";
                String  pages;
                String  p = request.getParameter("p");

                 if(!empty(p))
                     pages = java.io.File dir = new java.io.File(pages_dir,0);

                String wew = p+".jsp";
                List nameList = Arrays.asList(wew);

            %>


这不清楚,因为我搞糊涂了。

对不起,我不明白你的问题。。你可以在我的问题中看到编码,这是php代码,我想把这段代码转换成jsp。因为我学会了在你的问题中发布你的代码,而不是作为评论中的链接。我更新了我的问题