Tuesday, November 29, 2011

In struts why we use jsp as presentation layer? can we use servlet as presentation layer?

1. We can seperate the business logic from presentation logic:"...it is not possible in all cases and it combines the businesslogic and presentation logic which reduces security" - :actually business logic consists of logical coding which we generally write in servlets but presentation logic donot consist of any logical syntaxes..like in jsp so as to separate these two we write the presentation and business logic separately:We can do but not reccommended coz if we take servlet as a view, presenatation logic of website will be changed at regular intervels. Any modification in JSP doest force us for recompilation & reload of web applaication.where as any modification in servelt source code forces the programmer to recompile the servlet & to reload the web applaication. So,prefer taking JSP as view.:if we use servlet as a view than we need to write the presentation logic inside java code.. second reason if we modify the presentation logic then we should recomplie ,redeploy, and we need to restart the server... finally jsp is suitable t use as view becoz if any Presentation logic is modified then it will be automatically updated
Category:Struts Interview Questions

No comments:

Post a Comment