Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load a jsp-file from a servlet (App Engine)

I would like to load a jsp file from a servlet-class I got in my App Engine project. I has been able to load jsp files by adding them to the web.xml file but is there any way to load them directly from a servlet class?

Edit: I have tried this without success (no error msg or anything) req.getRequestDispatcher("file.jsp").forward(req, resp);

like image 536
Irro Avatar asked May 08 '10 10:05

Irro


2 Answers

If you want to include a JSP in the generated response, use

 request.getRequestDispatcher("/file.jsp").include(request, response);

If you want to forward to that jsp, use

 request.getRequestDispatcher("/file.jsp").forward(request, response);
like image 132
Bozho Avatar answered Oct 31 '22 22:10

Bozho


I was able to solve it myself. Had to add ./ before the filename...

req.getRequestDispatcher("./file.jsp").forward(req, resp);
like image 42
Irro Avatar answered Nov 01 '22 00:11

Irro