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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are default methods ?

780


Why object class is super class for every class in java?

791


How will you load a specific locale?

737


What is a stringbuffer?

746


What is the difference between java applets and applications?

842


Can I overload to string method

1166


What is * argv?

932


Explain how to convert any java object into byte array.

750


Why can't you declare a class as protected?

800


Difference between keyword and identifier.

777


What is natural ordering in java?

728


What does += mean in java?

785


Why we used break and continue statement in java?

791


what happens when a thread cannot acquire a lock on an object? : Java thread

810


What is finalize() function in java?

753