Results 1 to 6 of 6

Thread: Servlet container "sendRedirect"

  1. #1
    Join Date
    Dec 2009
    Posts
    204

    Servlet container "sendRedirect"

    Hello,
    I have my index.jsp page that contains the include the following:
    Code:
    <jsp: include page ="/ content / foo / bar.html"/>
    And a servlet is configured with the following mapping:
    Code:
    <url-pattern> / content/ * </ url-pattern>
    So the servlet is called when the induces contained in the index.jsp page When my servlet contains the following code in doGet:
    Code:
    response.getWriter().System.out.println("hello");
    Well I get on my page index.jsp. By cons, when I put this:
    Code:
    response.sendRedirect(link);
    The variable link url contains a valid property but nothing is returned to include. Is it impossible to use sendRedirect a servlet that is called when a jsp: include?
    Last edited by Ash maker; 18-01-2010 at 02:30 PM.

  2. #2
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Servlet container "sendRedirect"

    Hello,
    Code:
    <jsp:include .../>
    can include a JSP in a JSP. It can not retrieve a result of a query.
    Code:
    response.sendRedirect(String)
    you can run a new query (like the HTTP code 304 with a parameter, the rental value). Use this in your program and try if the program works, if it does well and good else you can post your query.

  3. #3
    Join Date
    Dec 2009
    Posts
    204

    Re: Servlet container "sendRedirect"

    Hi,
    Yes, it is true.
    Code:
    <jsp:include .../>
    also allows the inclusion of results from a servlet, if the URL passed as parameter in a target. So what I want to do is put a sendRedirect while processing servlet that, but I think it's impossible ..? If you have a solution round it, then please post.

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Servlet container "sendRedirect"

    Hello,
    SendRedirect in the servlet called. That is the function is called from the srevlet. And it will look something like this.
    Code:
    <% return; %>
    after the include of servlet? This gives:
    Code:
    <jsp:include ..../>
    <% return; %>
    Hope this helps you.

  5. #5
    Join Date
    Dec 2009
    Posts
    204

    Re: Servlet container "sendRedirect"

    Hey,
    No actually not in the sendRedirect, but rather something like:
    Code:
    request.getRequestDispatcher(path).include(request, response);
    except that the path in question is not necessarily, a relative path to a jsp but can be anything and everything eg:
    / components / page.jsp
    / foo / titi.xml
    super.html
    I hope you are getting my point, what I am trying to explain.

  6. #6
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Servlet container "sendRedirect"

    Hello,
    The "include" and is the term included the url it flows out of the url-pointed by the RequestDispatcher in the output stream of the appellant jsp (this is also valid for a servlet). We must be careful, because the flow is added to the existing stream, imagine that the appellant JSP is text / html and the URL is pointing to text / xml, what it it will be html? or xml?

Similar Threads

  1. Replies: 3
    Last Post: 10-01-2014, 10:40 AM
  2. Replies: 3
    Last Post: 18-08-2010, 04:32 PM
  3. Replies: 6
    Last Post: 18-05-2010, 12:27 AM
  4. What is Servlet container?
    By Sonam Goenka in forum Software Development
    Replies: 5
    Last Post: 05-02-2010, 08:13 AM
  5. Replies: 1
    Last Post: 06-11-2007, 02:18 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,129,569.28420 seconds with 17 queries