Struts a little confused

xiaoxiao2021-03-06  19

Using the data source in Struts Problem: How to use the data source defined in the struts_config.xml file in trying layers and model layers? Preliminary ideas are:

1. Write a class dbbind with a parameter-free constructor, where the package container is responsible for initialization data sources (completed JNDI and container communication in DBBIND, the data source of the capacitary protection is dbbind attribute) 2, in the view Writing , the instance of DBBIND is used as the application level global variable. View layer (all .jsp files, you can reference) 3, This global variable is obtained in the model layer to use.

The upper side is taught me, and it is estimated that it can be done. But what makes me confused, since Struts is a real thing of MVC, the most eligible is hierarchical, why have such a bad design. Since it can be implemented like the method of the upper side, why not directly use the DS belt directly, maybe I just exposed to Struts, I haven't understood the essence of it, I would like to understand it in a few days. .

转载请注明原文地址:https://www.9cbs.com/read-41403.html

New Post(0)