redirect to html page
hi i am having some problems redirecting from one servlet to another
if i use
it works fine, but i am trying to redirect to a page that i have locally on tomcat
( i had the www here with the com at the end but was unable to post )
the absolute path is
i have tried using this , plus relative paths
none of which work ??
1st question .
is the classes folder the right spot for the html pages as well
how do i access it in this position
I think classes is not a good place for an HTML file. You should create a directory underneath WEB-INF called HTML or something like that. At least that is what I do.
I think the problem is that sendRedirect needs a full URL (not file path on the server) as it results in a completely new Request for the client.
You might want to try the "request.forward" method, but I am not exactly sure what you are trying to achieve.
I am new to tomcat and JSP but I hope that helps.
i think your right !!!!
i don't think that you can redirect to a html that's on your local machine....
i used the forward method to go directly to a servlet page
and it worked a treat :):):)
String path= "/display";
RequestDispatcher dispatcher =servletContext().getRequestDispatcher(path);
the whole idea is that i am redirecting from a logon page to a display page, which displays tables from a data base ...
thanks again for the help :)
Glad I could be of help. I am always getting help from other people so it is nice to return the favour.
You can redirect to HTML on your local machine you just need the full URL to that page, same as if you were browsing to it.