I tried to call servlet from a JSP page, but it has the following status 500 runtime error:
[javac] import GenerateHTML ;
<%@page import = "GenerateHTML " %>
GenerateHTML obj = new GenerateHTML ();
public class GenerateHTML extends HttpServlet
public void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
The import might expect a . in the import statement, since you usually put your java classes in packages. Of course, you can put it in the default package as well and this should be supported, but it obviously isn't.
Anyway, I think you're violating the servlet's lifecycle by instantiating it yourself. You should let the servlet container do that. Just define your servlet in web.xml, map it to a request URI, say /GenerateHTML and then use
<jsp:include page="/GenerateHTML" flush="true"/>
to call the servlet.
...which is criticized correctly by the javac compiler.