This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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: 60041
    
  65

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: 60041
    
  65

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
 
Similar Threads
problem in login
Problems during struts application migration from weblogic 6.1 to weblogic 8.1
POSTing from servlet to JSP
Servlet to html
Using redirect from backing bean and getting IllegalStateException error