网站制作前景,怎么在百度提交网站,天津建设网网站打不开,赚钱软件排行在配置action …./元素时#xff0c;需要指定name,class和method属性#xff0c;这三个属性都支持通配符。 例如#xff1a; 1.action name ”*Action” class “student.RegisterAction” method “{1}” 如果用户请求的URL为loginAction.action,则调用…在配置action …./元素时需要指定name,class和method属性这三个属性都支持通配符。 例如 1.action name ”*Action” class “student.RegisterAction” method “{1}” 如果用户请求的URL为loginAction.action,则调用student.RegisterAction中的login()方法 2.action name”*Action” class “student.{1}Action” 如果用户请求的URL为loginAction.action则调用student.LoginAction中的execute(),因为没有指定method属性既总是使用execute方法来处理用户请求。 3.action name ”*_*” method “{2}” class”actions.{1}” 如果用户请求为Book_save.action则调用Book处理类的save()方法来处理用户请求 4.action name”*”result/{1}.jsp/result/action 改action匹配任意的Action即所有的用户请求都可以通过该Action来处理。因为没有为该action指定class属性即该action使用ActionSupport来作为处理类而且因为该ActionSupport类的execute()返回的的success字符串即该action总是直接返回result中指定的jsp资源。 当使用通配符配置action时会经常出现一个action请求符合多个action的情况。此时会先在Struts.xml文件中查找同名的action没有使用匹配符则一定由该Action来处理用户请求。如果没有则查找带有匹配符的action此时是先找到那个符合的action由那个进行处理。 即除非请求的URL与action的name属性绝对相同否则将按先后顺序来决定哪个action来处理用户请求。因此应该将名为*的action配置在最后否则struts2将使该action来处理所有希望使用模式匹配的请求转载于:https://www.cnblogs.com/prairielonewolf/p/3425898.html