Today I faced a question in the interview,
'What if I use jsp as controller & not servlet. Business logic has been proceeded by the model only.
only request & response would be proceeded by jsps & forget about the maintanace,complexity & all.
I answerd like presentation logic would be mixed with the java code which normally is used in servlet which is not good.
But he didnt get satisfied.
Is there any other reason for it?
JSPs are meant for presentation. While technically one can do anything in a JSP that can be done in a servlet, that doesn't make it wise. This sounds like a question to see if you hold your ground about a bad idea. Or someone who truly doesn't know better.
You can say as
first thing is it will be a bad practise.
and yes as jsp gets converted to servlet we can treat it as servlet and do it work as a controller. jsp can do whatever servlet can I think so please correct me.
Regards, Vijay Jamadade.
( Nothing is Impossible.)