the question is strange some way I think, and I can't find a direct answer to it, so please be patient with me
I am working on a service at company using Servlets.
based on some condition in code i will proceed the request to one of two servlets.
if(SOME_CODITIONS == VALUE1)
getServletContext().getRequestDispatcher("/SERVLET_1").forward(request,response);
else
getServletContext().getRequestDispatcher("/SERVLET_2").forward(request,response);
Some one told me that using a bean that contains the code and calling that method to do the same job the servlet has to do is better, and this (the above one) has weak performance and the bean way is better.
Is that correct and does forwarding the request will allocate more memory?
NOTE: the code that written in SERVLET_1 or SERVLET_2 will not be called directly from browser
hope any one has one tip to share it with me.