Results 1 to 6 of 6

Thread: [RESOLVED] Navigation between jsp and java servlet.

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2005
    Location
    middle earth
    Posts
    95

    Resolved [RESOLVED] Navigation between jsp and java servlet.

    I am calling a servlet from a jsp. I want the result from the servlet back into the calling JSP. How do I do this?

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Navigation between jsp and java servlet.

    How are you calling, and what is the result of the servlet?
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 2005
    Location
    middle earth
    Posts
    95

    Re: Navigation between jsp and java servlet.

    I am using the action attribute of the Form tag to go to the servlet. The servlet connects to the database, retrieves data. Now i want this data back into the calling jsp.

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Navigation between jsp and java servlet.

    So it is really the client submitting a form to a servlet?

    You could put the data into request attributes and then forward to the JSP. See javax.servlet.RequestDispatcher.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Dec 2005
    Location
    middle earth
    Posts
    95

    Re: Navigation between jsp and java servlet.

    I have used response.sendRedirect() to send Data through the URL. I pick up the data using request.getParamater() from the JSP.
    Thanks for your help CornedBee.

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: [RESOLVED] Navigation between jsp and java servlet.

    Don't use sendRedirect(). It gives an inappropriate HTTP code.

    Use the sendResultRedirect() method I presented in this thread:
    http://www.vbforums.com/showthread.php?t=450148
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width