Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/384.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 从servlet类调用jsp页面没有';不行?_Java_Servlets - Fatal编程技术网

Java 从servlet类调用jsp页面没有';不行?

Java 从servlet类调用jsp页面没有';不行?,java,servlets,Java,Servlets,我试图从servlet类中查看jsp页面,问题是Produit.jsp在SaisieProduit.jsp(因此它不是web.xml的问题)时工作正常,也就是在运行SaisieProduit.jsp而不通过servlet类时,它正常工作 这是我的servlet类 protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOExceptio

我试图从servlet类中查看jsp页面,问题是Produit.jsp在SaisieProduit.jsp(因此它不是web.xml的问题)时工作正常,也就是在运行SaisieProduit.jsp而不通过servlet类时,它正常工作

这是我的servlet类

protected void doGet(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
        String path=req.getServletPath();

        if(path.equals("/index.do")){
            req.getRequestDispatcher("produits.jsp").forward(req, resp);
        }
        else if(path.equals("/chercher.do")){
            String motCle=req.getParameter("motCle");

            ProduitModel model=new ProduitModel();
            model.setMotCle(motCle);            
            List<Produit> produits=new ArrayList<Produit>();
             produits=metier.produitsParMC(motCle);
            model.setProduits(produits);
            req.setAttribute("model", model);
            req.getRequestDispatcher("produits.jsp").forward(req, resp);

        }

        else if(path.equals("/saisie.do")){
            req.getRequestDispatcher("SaisieProduit.jsp").forward(req, resp);
        }



    }

}
protectedvoid doGet(HttpServletRequest-req、HttpServletResponse-resp)
抛出ServletException、IOException{
字符串路径=req.getServletPath();
if(path.equals(“/index.do”)){
req.getRequestDispatcher(“produits.jsp”).forward(req,resp);
}
else if(path.equals(“/chercher.do”)){
字符串motCle=req.getParameter(“motCle”);
ProduitModel模型=新的ProduitModel();
模型:刚毛(斑点);
List produits=new ArrayList();
produits=metier.produitsParMC(斑点);
模型.集合产品(产品);
请求setAttribute(“模型”,模型);
req.getRequestDispatcher(“produits.jsp”).forward(req,resp);
}
else if(path.equals(“/saisie.do”)){
req.getRequestDispatcher(“SaisieProduit.jsp”).forward(req,resp);
}
}
}
这是saisie.do的链接

<div class="navbar navbar-default">
  <ul class="nav navbar-nav">
  <li><a href="index.do">Home</a></li>
  <li><a href="saisie.do">Saisie</a></li>
</ul>

</div>

当我点击saisie时,会出现一个覆盖页面


你能发布你的
web.xml
?@guleryuz这个错误不是由于web.xml造成的,因为我有另一个正常工作的jsp页面。你可以只发布
Servlet映射
你的
web.xml
?web.ControlEurServlet:)的一部分吗
*。你有
.do
ControlEurServlet
映射吗
web.xml