Results 1 to 4 of 4
Thread: redirect to html page
- 02-11-2009, 05:53 AM #1
Member
- Join Date
- Dec 2008
- Posts
- 50
- Rep Power
- 0
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 tomcatJava Code:response.sendRedirect("google"); ( i had the www here with the com at the end but was unable to post )
called display.html
the absolute path is
Java Code:C:\tomcat\apache-tomcat-6.0.18\webapps\coffee\WEB-INF\classes\display.html
i have tried using this , plus relative paths
ie
none of which work ??Java Code:response.sendRedirect("display.html"); response.sendRedirect("/display.html"); response.sendRedirect("classes/display.html"); response.sendRedirect("/classes/display.html"); response.sendRedirect("coffee/classes/display.html");
1st question .
is the classes folder the right spot for the html pages as well
ie coffee/classes/display.html
2nd question
how do i access it in this position
- 02-11-2009, 09:12 PM #2
Member
- Join Date
- Feb 2009
- Posts
- 13
- Rep Power
- 0
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.
- 02-12-2009, 02:06 AM #3
Member
- Join Date
- Dec 2008
- Posts
- 50
- Rep Power
- 0
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 :):):)Java Code:String path= "/display"; RequestDispatcher dispatcher =servletContext().getRequestDispatcher(path); dispatcher.forward(request,response);
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 :)
- 02-12-2009, 05:18 PM #4
Member
- Join Date
- Feb 2009
- Posts
- 13
- Rep Power
- 0
Similar Threads
-
How to open html page?
By smartsubroto in forum New To JavaReplies: 8Last Post: 08-16-2012, 12:13 PM -
Redirect page in web service
By bluesheeva in forum Advanced JavaReplies: 3Last Post: 02-03-2009, 11:56 PM -
Redirect Page in SOAP Message Handler
By bluesheeva in forum Advanced JavaReplies: 0Last Post: 12-28-2008, 12:43 PM -
redirect page within a java applet
By paul in forum Java AppletsReplies: 1Last Post: 08-07-2007, 05:11 AM -
HTML page
By bbq in forum New To JavaReplies: 1Last Post: 07-05-2007, 03:46 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks