Results 1 to 2 of 2
  1. #1
    Rashmi is offline Member
    Join Date
    Mar 2015
    Posts
    1
    Rep Power
    0

    Default Redirect from one servlet to another servlet?

    I m stuck at some point in servlet as m beginner.I have to create two button i.e add and search.When i click on add button ..it should open tht page and when i click on search page it open search page..i put tht two buttons on one servlet page and i have to redirect to other servlet page..how can i do?

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: Redirect from one servlet to another servlet?

    You misunderstand what a redirect is. That happens when you navigate to a web resource (or rather: make the browser navigate to a web resource) and then for any reason cause the client to direct to another resource instead. That's the re-direct; you navigate to a resource, but rather than loading that resource you load another instead.

    Here you do not want to redirect, you simply want to navigate to a web resource when you click a button. The fact that this web resource is a servlet makes no difference, its simple HTML linking to a particular url. The add button links to one url, the search button to another.

    That's pretty much the bare basics of servlets; you have to be able to figure that out on your own. This free online book can help you:

    Free Online Version of Core Servlets and JavaServer Pages (Second Edition) in PDF
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. Creating a redirect servlet
    By limeleaf in forum Java Servlet
    Replies: 2
    Last Post: 07-03-2013, 09:17 AM
  2. Redirect to jsp from Servlet using sendRedirect method
    By pateldpk in forum Advanced Java
    Replies: 9
    Last Post: 04-17-2012, 12:42 PM
  3. redirect to a servlet page
    By niteangell21 in forum New To Java
    Replies: 5
    Last Post: 11-15-2010, 02:53 PM
  4. How can I redirect in servlet?
    By Heather in forum Java Servlet
    Replies: 1
    Last Post: 07-14-2007, 05:52 PM

Tags for this Thread

Posting Permissions

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