I tried to call servlet from a JSP page, but it has the following status 500 runtime error:
'.' expected
[javac] import GenerateHTML ;
<%@page import = "GenerateHTML " %>
<%
GenerateHTML obj = new GenerateHTML ();
obj.service(request, response);
%>
public class GenerateHTML extends HttpServlet
{
public void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
//etc...
}
}
any ideas??
-
status 500 error to call a servlet from a JSP page (2 messages)
- Posted by: Matt Louden
- Posted on: June 08 2004 20:27 EDT
Threaded Messages (2)
- status 500 error to call a servlet from a JSP page by Thomas Jachmann on June 09 2004 05:23 EDT
- There's a space in your import statement... by Rene Zanner on June 09 2004 07:47 EDT
-
status 500 error to call a servlet from a JSP page[ Go to top ]
- Posted by: Thomas Jachmann
- Posted on: June 09 2004 05:23 EDT
- in response to Matt Louden
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.
HTH,
Thomas -
There's a space in your import statement...[ Go to top ]
- Posted by: Rene Zanner
- Posted on: June 09 2004 07:47 EDT
- in response to Matt Louden
...which is criticized correctly by the javac compiler.
Cheers,
René