• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Servlet call from index.jsp

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI,
I called a servlet from index.jsp its successfully loaded, after creating a database and stored a value into bean need to redirect the same page to display the bean in index.jsp.
Can anyone tell me what to write in servlet init() method to redirect into index.jsp page

Thanks in advance.









 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
use requestDispatcher to redirect to the same page i.e index.jsp in your servlet service()...
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Yayathi Jayaraman wrote:Can anyone tell me what to write in servlet init() method to redirect into index.jsp page


The init() method has nothing at all to do with servicing a request. This is not the place to do anything like that.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

jagdeesh kumar wrote:use requestDispatcher to redirect to the same page i.e index.jsp in your servlet service()...


Nope. The RequestDispatcher is used to forward to a JSP. A redirect is accomplished via the sendRedirect() method.
 
reply
    Bookmark Topic Watch Topic
  • New Topic