Let’s say there is no strut2 framework, we
want to implement our own MVC framework. We need to do the below things.
I want to build MVC framework likes above
figure. Below are things we need to do at least.
1.
Read the request parameters and convert them
to corresponding java types.
2.
Writes a controller program, which receives
the given request and passes it to the corresponding business service (Model) .
3.
Controller calls the specific view based on
the result from business service (Model).
4.
Develop general purpose tag libraries for
view.
5.
If necessary, MVC framework must validate the
request data.
6.
Support different types of result formats
like XML, PDF etc.,
But if you use struts you no need to worry
about the controller, result parts etc., you just concentrate on Business
logic, leave the rest to struts.
What struts provides?
1.
It instantiates the request parameters with
the action class properties. You no need to worry to convert request parameters
to specific java types.
2.
Struts invoke the specific action method
related to given request and get the result.
3.
Based on the result from action method, it
display respective view.
4. Struts supports the
various types of Results like Dispatcher Result, Velocity Result,HttpHeader
Result, Redirect Result, XSL Result, Redirect Action Result, Stream
Result, PlainText Result, Tiles Result, FreeMarker Result.
5.
Struts supports validating the request data
before calling the action method.
6.
Struts provides number of custom tags for
displaying data, data conversion, Internationalization, AJAX etc.,
No comments:
Post a Comment