Why can't we make jsp as a controller and action
servlet in struts?

Answers were Sorted based on User's Feedback



Why can't we make jsp as a controller and action servlet in struts?..

Answer / aditya sinha

JSP is a part of presentation layer(View in MVC pattern)
which should be decoupled from controller or model, because
of its benifits of flexibility and modularity and focussed
responsibility.

By having the controller separate, we allow to choose the
presentations dynamically. But having them integrated
implies, change in presentation logic may also fiddle with
the controller segment embedded. Any new presentation would
attract unnecessary controller code repetition into it.

More over, if its(the controller segment) only an include
in JSP, then the overhead of JSP parsing to servlet is not
worth doing it.

Is This Answer Correct ?    2 Yes 0 No

Why can't we make jsp as a controller and action servlet in struts?..

Answer / punna

Aording to industry standards Jsp must be "Java ode Less
Jsp". But when it taken controller it must contain java
code to communicate with model components,So we try to take
the java class servlet to plae integration logic

Is This Answer Correct ?    4 Yes 3 No

Why can't we make jsp as a controller and action servlet in struts?..

Answer / altaffur

because of MVC2 pattern

Is This Answer Correct ?    3 Yes 2 No

Why can't we make jsp as a controller and action servlet in struts?..

Answer / srinu

Jsp means "LESS JAVA CODE" and also tag based program.Their
is no tag intigriate with other logic.so jsp is not
suitable for controller.when we take ActionServlet or
Servlet as contoller for suitable.This class contain pure
java code and also intigrate with other logic and follows
oops priniciple,MVC principle.

Is This Answer Correct ?    1 Yes 1 No

Why can't we make jsp as a controller and action servlet in struts?..

Answer / raghu

When JSP compiles, internally the jsp compiler converts the
servlets and compiles servlets java and generartes the
class file. Every time it will do the same thing, so it may
take several time. It may cause performance issue.

Is This Answer Correct ?    1 Yes 2 No

Why can't we make jsp as a controller and action servlet in struts?..

Answer / guest

beans are object and object can act as component

Is This Answer Correct ?    0 Yes 1 No

Why can't we make jsp as a controller and action servlet in struts?..

Answer / sivadasan

Most of the applications are created in MVC design pattern
to seperate the functions of differnet components and
handle the complexity of applications.

JSP and Servlets are the server side components which can
respond to the client request.

Servlets are the basic components for request handling in
Web Server. They contains pure Java code.

Everything that needs to be done to generate the proper
user response (which is genarally HTML code) needs to be
done through coding. As a single servlet cannot respond
each and every request by itself as client request varies
in type (e.g. enquiry update request add etc) the request
and response object is passed onto different servlets with
little task completed by each servlet.

This controlling part is easier to write in java. So
Servlet is used as controller.

Is This Answer Correct ?    0 Yes 2 No

Why can't we make jsp as a controller and action servlet in struts?..

Answer / amareshara

Becoz in the JSP all only our business logic is described.
but MVC we can all the logic (i.e. B.L.,P.L.) are separated
asap.

Is This Answer Correct ?    1 Yes 6 No

Post New Answer

More Core Java Interview Questions

What is double parsedouble in java?

0 Answers  


What is backdrop?

0 Answers   Atos Origin,


What is meant by stack and queue?

0 Answers   GrapeCity,


is it possible to instantiate the math class?

0 Answers  


What is the difference between yield() and sleep()?

0 Answers  






What does it mean that a method or field is “static”?

0 Answers  


Why Set interface contains unique elements, what internally implemented for this so that it contains unique elements?

1 Answers   Rolta, TCS,


How is tree Mirroring implemented?

0 Answers   Fidelity,


What is preflight request?

0 Answers  


What is a method in coding?

0 Answers  


Difference between Application and Applet ?

4 Answers   Wipro,


Why do we override tostring method in java?

0 Answers  


Categories