You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "M.Hockings" <ve...@hockings.net> on 2004/07/06 19:06:58 UTC
lost output including a servlet in a JSP which includes a JSP
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.
Mike
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: lost output including a servlet in a JSP which includes a JSP
Posted by Tim Funk <fu...@joedog.org>.
The invoker is just another servlet.
http://jakarta.apache.org/tomcat/faq/misc.html#invoker
-Tim
M.Hockings wrote:
> How does one do that? Would it be spec compliant ?
>
> Mike
>
> Tim Funk wrote:
>
>> But it is not spec compliant. YOu can always use the invoker servlet.
>>
>> -Tim
>>
>> M.Hockings wrote:
>>
>>> That would be what I tend to call a "named servlet". I find that in
>>> a portal environment that named servlets that are not portlets do not
>>> seem to be allowed. I want a solution that will allow me to pull in
>>> some utility content generation servlets without having named servlets.
>>>
>>> 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: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: lost output including a servlet in a JSP which includes a JSP
Posted by "M.Hockings" <ve...@hockings.net>.
How does one do that? Would it be spec compliant ?
Mike
Tim Funk wrote:
> But it is not spec compliant. YOu can always use the invoker servlet.
>
> -Tim
>
> M.Hockings wrote:
>
>> That would be what I tend to call a "named servlet". I find that in a
>> portal environment that named servlets that are not portlets do not
>> seem to be allowed. I want a solution that will allow me to pull in
>> some utility content generation servlets without having named servlets.
>>
>> 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: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: lost output including a servlet in a JSP which includes a JSP
Posted by Tim Funk <fu...@joedog.org>.
But it is not spec compliant. YOu can always use the invoker servlet.
-Tim
M.Hockings wrote:
> That would be what I tend to call a "named servlet". I find that in a
> portal environment that named servlets that are not portlets do not seem
> to be allowed. I want a solution that will allow me to pull in some
> utility content generation servlets without having named servlets.
>
> 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: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: lost output including a servlet in a JSP which includes a JSP
Posted by "M.Hockings" <ve...@hockings.net>.
That would be what I tend to call a "named servlet". I find that in a
portal environment that named servlets that are not portlets do not seem
to be allowed. I want a solution that will allow me to pull in some
utility content generation servlets without having named servlets.
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: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: lost output including a servlet in a JSP which includes a JSP
Posted by Tim Funk <fu...@joedog.org>.
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: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: lost output including a servlet in a JSP which includes a JSP
Posted by "M.Hockings" <ve...@hockings.net>.
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: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: lost output including a servlet in a JSP which includes a JSP
Posted by Tim Funk <fu...@joedog.org>.
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: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org