码迷,mamicode.com
首页 > 其他好文 > 详细

The thinking of struts2 namspace

时间:2014-12-07 23:13:36      阅读:169      评论:0      收藏:0      [点我收藏+]

标签:jsp   xml   struts2   namespace   

    In the lastduring, I am studying the basic about struts2.

    At be ginning,I always am confused by the namespace of struts2 xml configuration file.

    Cause, sometimes I shall read some examplesthat have namespace in configuration file but no the namespace in action of JSP.

     However, the definition of namespace is a path tofind action. Therefore, I feel it is strange why JSP has no namespace ratherstruts xml could have?

    Think in a second, then I read references some,finally, I could think me to be a little clear about the namespace. Cause thenamespace has another function that is to    recognize same name action in oneproject.

    In the while, the request sends a order to action,and must have a action receive the order and to execute it. In the time, whocould receive this order? It will be judged by the namespace. The method that findsthe action in the struts xml file is to use relative path ,that is afterrequest’s current path is followed by namespace and action name.

   Take one example, a commanding officer will give aorder to A, concurrently, it has each an A in NO.1 troop and NO.2 troop. So thiscommanding officer could give the order, if he is in any a troop. If he were inown office, he would have specific troop’s A.

   At now, struts2 also is same with the commander. Whenit give a order to a result in same package, JSP could omit the namespace. But whenthis result cannot exist in same package, JSP’s action would not have to omitnamespace. Otherwise, the server would throw a wrong that could not find pathof action.

The thinking of struts2 namspace

标签:jsp   xml   struts2   namespace   

原文地址:http://blog.csdn.net/anglebeat/article/details/41793539

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!