struts.xml and struts-config.xml

安稳与你 提交于 2019-12-04 10:22:28

问题


What is the difference between struts.xml and struts-config.xml? Are both the same or is there any difference between them?


回答1:


The core configuration file for the Struts framework is by default the struts.xml for Struts 2 and struts-config.xml for Struts 1.

They are both configuration files so that is the same, but they are different beasts because they refer to different versions of the Struts framework.

There are large differences between Struts 1 and 2 as you can see here.

The files have different structure and content so you can't really compare one with the other (except for their purpose).




回答2:


struts.xml is the Struts2 configuration file,

we can not change this file name, if we change this name Framework could not identified the configuration file... and one more thing per single Struts2 application there should only single struts.xml file.

where as in Struts 1.x default configuration file is struts-config.xml

in this we can change the default configuration file name and we can have multiple configuration files..




回答3:


They are the basically the same file, where you configure your struts actions etc. but for different versions of struts. struts-config.xml in struts 1 and struts.xml in struts 2.




回答4:


Basically, struts.xml is configuration file for struts2 which includes mapping of both jsp and action file. Strus-config.xml is the file for struts1.x which included mapping of actions files. In struts2 filter is considered as a front end controller which define into the struts.xml and for struts1.x, Action Servlet is considered as a front-end controller and its mapped into the struts-config.xml.




回答5:


struts.xml is the Struts2 configuration file struts-config.xml while is the name generally has the Struts configuration file (1.3.x)




回答6:


struts-config.xml is default configuration file,that was given by struts 1.x framework, where as struts.xml is configuration file for struts 2.x



来源:https://stackoverflow.com/questions/2988742/struts-xml-and-struts-config-xml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!