The solution that I gave below seems to work OK for the servlets themselves but if they include another servlet or jsp then the output of that next level included thing appears to be discarded.
Mike
Tim Funk wrote:
The servlet class should be mapped to a path in web.xml
-Tim
M.Hockings wrote:
Ok, I would tend to agree. But, how can I get a request dispatcher without loading the servlet by classname?
i.e., RequestDispatcher rd = request.getRequestDispathcer("/servlets/my-servlet-classname");
Mike
Tim Funk wrote:
This is all wrong. You need to get a RequestDispatcher via:
<jsp:include> or <jsp:forward>
-- or --
RequestDispatcher rd = request.getRequestDispathcer(myPath); rd.include(request, response);
-Tim
M.Hockings wrote:
What I want to do is to include a servlet in a .JSP. For reasons that I won't go into please assume that in the environment that I wish this to run I cannot define a named servlet nor can I load by classname.
A simplified version of what I have been doing is below:
<% Class c = Class.forName("name-of-the-servlet-class"); Servlet s = (Servlet) c.newInstance(); s.init(this.getServletConfig()); s.service(request, response); %>
This sorta works. That is, it will load and run the servlet and the output from the servlet is deliverd to the browser. But if the called servlet class includes a .JSP then the output of that .JSP is never seen though if debugged it does run OK and produces output. The servlet itself is generated by compiling a .JSP with jspc. What am I missing.
I realize that this inquiry is not strictly Tomcat related but I figure that the people who will have the knowledge answer to my lost output mystery will be here!
Your thoughts on this problem are appreciated.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
