Search code examples
jspmodel-view-controllerstruts2daopojo

How Dao is independent of the view?


I may be asking a basic question but I did not get any answers so far for it.

<s:radio label="Gender" name="gender" list="{'male','female'}" />
</s:form>

in the above code name="gender" is the name of the action class' attribute now if I happen to change this name in action class I must change it in my JSP (view) & vice-verse & so there is a dependency, so how the two layers View & Model are independent?

Please tell or provide links,thank you.


Solution

  • If you treat a View as a Model you can't get independence. The Model (if you have a model) is actually tightly integrated with the persistence layer. Struts2 is a strict front-end framework, it doesn't contain models other than View models. So, staying independent it integrates with other frameworks like Hibernate or JPA where the model is mapped to the persistence layer. All the mappings you perform in Struts2 is between a View and Controller.

    The links: