I give u an example to get what i mean. I have a simple site with just 2 pages. The main page includes another page (let's say that the page included is the page with the site menu).
I have to do some dynamic operation in that menu, so i want to control that menu by using a servlet.
After i did some "stuff" in the servlet i want to tell the servlet to "redirect itself" to a jsp page and print, on that page (that is included by the main page), what i passed from the servlet to the jsp page.
I can't do it with this code
request.setAttribute("var", var)
request.getRequestDispatcher(destinationPage).forward(request, response)
because, of course, all my site would be redirected to the page "destinationPage" and not just the include page!
Instead, is it correct to use this code in the servlet?
request.setAttribute("var", var)
request.getRequestDispatcher(destinationPage).include(request, response);
Can i handle many includes with the code above?
What's the right way to handle many includes in a jsp "main" page?
Thank you