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

Questions by sadashivarao   answers by sadashivarao

Showing Answers 1 - 7 of 7 Answers

raj

  • May 13th, 2006
 

no we can not use servlet as a presentation layer in struts even though jsp converted as servlet at the back.bcos we can seperate presentation and business logic as part of jsp using java beans.but in servlets we can not seperate presentation and business logics.

  Was this answer useful?  Yes

suneel

  • May 14th, 2006
 

1. We can seperate the business logic from presentation logic

2.It facilitates to write the java code inside a html environment

if we use servlets then we need to write the html tags inside out.write() number of times. it is not possible in all cases and it combines the businesslogic and presentation logic which reduces security

  Was this answer useful?  Yes

Amzad Basha

  • May 20th, 2006
 

The purpose of Servlets is not meant for presentation in MVC Architecture, but JSPs are used in the presentation tier of MVC architecture.

  Was this answer useful?  Yes

U.Vellaisamy

  • May 21st, 2006
 

jsp

1.Struts framework is basically using the taglib so we can import taglib, it is possible for jsp elements.

Directive tag

<%@ taglib uri="WEB-INF/struts-bean.tld" prefix="bean.tld"%>

<%@ taglib uri="WEB-INF/struts-html.tld" prefix="html.tld"%>

<%@ taglib uri="WEB-INF/struts-logic.tld" prefix="logic.tld"%>

servlet

No possible for import taglib

 

  Was this answer useful?  Yes

Well if you don't want to follow MVC [mvc-2], struts [or anyone] doesn't stop you from doing that.

If you don't do it, then you will loose the benifits that come along with the mvc architecture.


Thanks,
Vinay

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions