Problems with path from servlet to html.
Hello!I do not like jsp so much I like Servlets better. But I have one big problem when I develop a site with just Servlets, The path/link between a Servlet and a html-page.
Supose that you have a something like this.
A html-page that link to a servlet like:
(in mapp html, file x.html)
<a href=\"servlet/FileManagerTestServlet\"</a>
The Servlet, when executed, prints out the same html-page again, like
1 Read the file x.html
2 Do some change (imagine that you have to change somthing in that page.)
3 Print out that file with a PrintWriter, not with a sendRedirect.
Then we are in mapp /servlet/FileManagerTestServlet so when we click the link again we get a missmatch.
So if any one have some smart solution for this please let me know.
I got 2 solution my self but I do not like them, I guess there must be smarter one, perhaps config the webserver, I run a orion.
Stupid solution 1
When we execute the servlet we replace the path to the right path something like this:
servlet/FileManagerTestServlet => ../servlet/FileManagerTestServlet
Stupid solution 2
We change the path in the x.html file to this
<a href=\"filemanager_forward.jsp\">Filemanager</a>
and add a jsp-page in between with
<jsp:forward page=\"/servlet/FileManagerTestServlet\" />
then the Servlet would execute inside the jsp-page and we would stay in the same folder.
So if any one have a solution with out jsp and replaceing I would be most greatful.
Best Regards
Fredrik
