The Artima Developer Community
Sponsored Link

Java Answers Forum
how can we call a jsp from a servlet?

2 replies on 1 page. Most recent reply: Aug 19, 2002 9:54 PM by Keshav

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
senthil

Posts: 23
Nickname: rickk84
Registered: Aug, 2002

how can we call a jsp from a servlet? Posted: Aug 18, 2002 8:48 AM
Reply to this message Reply
Advertisement
how can we call a jsp from a servlet?
how can we call a file from a applet?


Javed

Posts: 15
Nickname: javedm
Registered: Aug, 2002

Re: how can we call a jsp from a servlet? Posted: Aug 19, 2002 1:40 AM
Reply to this message Reply
HI Senthi,

U can use RequestDespatchers sendRedirect() method or forward method to call a jsp from a servlet.

An applet cannot read local files. That is a restriction.

Keshav

Posts: 11
Nickname: kesh
Registered: Aug, 2002

Re: how can we call a jsp from a servlet? Posted: Aug 19, 2002 9:54 PM
Reply to this message Reply
Hi Senthil,

In a servlet, type in the following line in the service method

getServletConfig().getServletContext().getRequestDispatcher("sentil.jsp").for ward(req,res);

U can use either a jsp or a servlet. (sentil.jsp)

U can either use forward or include, but u need to pass the request & response objects. I am not sure of the redirect method since I haven't used it.

Hope ur clear with the code

Cheeeeeeeeeeeeeeers
Keshav

Flat View: This topic has 2 replies on 1 page
Topic: AWT Event Focus Listener Previous Topic   Next Topic Topic: About Jasper Report

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use