aspose file tools*
The moose likes Struts and the fly likes Servlet call from index.jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Servlet call from index.jsp" Watch "Servlet call from index.jsp" New topic
Author

Servlet call from index.jsp

Yayathi Jayaraman
Greenhorn

Joined: Aug 10, 2012
Posts: 7
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.









G krishna kumar
Greenhorn

Joined: Oct 10, 2012
Posts: 14
use requestDispatcher to redirect to the same page i.e index.jsp in your servlet service()...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61180
    
  66

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61180
    
  66

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet call from index.jsp