Why can't we make jsp as a controller and action
servlet in struts?
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
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 |
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 |
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 |
What is meant by distributed application? Why are we using that in our application?
Does unicode support all languages?
What causes memory leak in java?
What is a map in java?
What does null mean in java?
Differentiate Vector and ArrayList?
What is io stream in java?
What is static and final keyword in java?
Which class is extended by all other classes?
What do you mean by inner class in java?
Can an integer be null java?
suppose we have an interface & that interface contains five methods. if a class implements that interface then we have to bound that to give tha definition of all five methods in that class. If we declare that class as abstract then can we call only two methods to give the deinition of that method & i don't want to give the definition of all the methods? can it possible