Hey,
I’m using Spring MVC and I got used to “sending” DTO to a view without populating servlet request directly, which is very flexible and effective. I’m trying to figure out how to do something similar in Struts, because as far as I can see, the only way how to “send” DTO to view is via request dispatcher where servlet request is populated with DTOs in key – value style manually by programmer.
This results in having too much logic in view layer (JSPs) in comparison with Spring MVC.
Is this the only way of DTO transfer from handlers to a view layer ?
Generally the way I have seen it being done in Struts is via Form objects. This form class extends ActionForm. Then in the struts-config.xml you define this form as a a form bean. Then add a reference to the form bean in the action class bean definition. Then in the jsp you rerefence the form to get data from the DTO.
For example:-