复习struts2之Action配置的各项默认值

来源:互联网 发布:激光切割机怎么编程 编辑:程序博客网 时间:2024/05/22 14:34
在struts.xml文件中配置如下<action name="addUI"><result>/WEB-INF/page/employeeAdd.jsp</result></action>Jsp页面为:<form action="/xxx">姓名:<input type="text" name="xxx"/></form>通过路径http://localhost:8080/struts2/test/addUI访问得到的结果是一个可以输入的文本框,这是由于在struts.xml文件中对于action的配置中有许多的默认值各项默认值如下:1>如果没有为action指定class,默认是ActionSupport。 2>如果没有为action指定method,默认执行action中的execute() 方法。 3>如果没有指定result的name属性,默认值为success。ActionSupport中的execute() 方法返回的是SUCCESS,所以会转发给视图,既直接返回jsp页面在java中变量名为大写时,一般为常量

原创粉丝点击