alessandro
alessandro

Reputation: 1721

Invoke a JSP page from a Servlet

Can anybody help me how can I invoke a JSP page from a Servlet (just have to invoke, no need of passing parameters).

Upvotes: 0

Views: 103

Answers (2)

Sirko
Sirko

Reputation: 74036

Use the forward() or include() method of the RequestDispatcher (Docu):

getServletContext().getRequestDispatcher( "yourJspPath" )
                   .forward(request, response);

Upvotes: 2

Mario Peshev
Mario Peshev

Reputation: 1083

Not sure what 'invoke' is supposed to mean, but if we're talking about redirecting, it could be done like that:

response.sendRedirect("your.jsp");

Upvotes: 1

Related Questions