| Author |
Forward giving error
|
clyde melly
Ranch Hand
Joined: Sep 04, 2003
Posts: 152
|
|
import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class ForwardServlet extends HttpServlet { public void doGet (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { String message = "This is a test"; RequestDispatcher rd =req.getRequestDispatcher("login.html"); rd.forward(req, res); } } Requestdispatcher gives problem?kindly help
|
 |
Anand Loganathan
Greenhorn
Joined: Sep 13, 2003
Posts: 12
|
|
* The pathname specified may be relative, although it cannot extend outside the current servlet context. find out where your html file is existing * If the path begins with a "/" it is interpreted as relative to the current context root. give the pathname is ("/*.html") // relative path from servlet root. * This method returns null if the servlet container cannot return a RequestDispatcher. Make sure that your file is existing in the specified path.
|
 |
Kaustubh Patil
Ranch Hand
Joined: Aug 13, 2001
Posts: 164
|
|
|
Could you please specify what the problem is. Or rather put the stack trace.
|
Kaustubh. Mumbai, India.
|
 |
Nischal Tanna
Ranch Hand
Joined: Aug 19, 2003
Posts: 182
|
|
Is the html file in the same folder .I dont think so..so just specify the path according to the folder. for ex. if the servlet file is in classes folder and the html is in html folder. then write the code as getServletContext().getRequestDispatcher("../html/filename.html");
|
Thnx
|
 |
 |
|
|
subject: Forward giving error
|
|
|