tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pierre Delisle <pierre.deli...@sun.com>
Subject Re: including servlets in a customed tag
Date Thu, 29 Mar 2001 01:40:23 GMT


> David Treves wrote:
> 
> Hi,
> 
>     I am trying to include a servlet while processing a tag I wrote, I don't
> need specifically the request and response of the pageContext of that tag. I
> tried to include the servlet with new and with the existing request/response,
> both way the servlet simply was not included. it looks like it simply skips
> the including line.
> 
> the tag code is:
> 
> try{
>   ServletRequest request = pageContext.getRequest();
>   request.setAttribute("recipientId",userId); // add an attribute to be passed
> to the included file
> 
>   ServletResponse response = pageContext.getResponse();
>   System.out.println("in tag");
>   javax.servlet.RequestDispatcher rd =
> pageContext.getRequest().getRequestDispatcher("/courses/servlet/cacheUsers");
>   rd.include(request, response);
>   System.out.println("after including (in tag)");
> }
> catch(javax.servlet.ServletException e){
>   System.out.println("ServletException: " + e.getMessage());
> }
> 
> As you can see there are System outs and both of them printed. (the code was
> taken from the doEndTag())
> 
> Any idea whats wrong here?


Try 

    pageContext.include("/courses/servlet/cacheUsers");

instead of 

    rd.include(...)

  -- Pierre

Mime
View raw message