Default Action-Dive into Struts2

an introduction
When the wrong URL is entered, it will be transferred to the default ation to handle
 
Two configuration methods
<? xml version = "1.0" encoding = "UTF-8" ?>
<! DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" " http://struts.apache.org/dtds/struts-2.1.dtd" ; >
< struts >
         < package name = "default" namespace = "/" extends = "struts-default" >
                 < default-action-ref name = "index" ></ default-action-ref >
                 < action name = "index" >
                         < result > /error.jsp </ result >
                 </ action >
                
                 < action name = "*_*_*" method = "{2}" class = "com.cakin.{3}.{1}Action" >
                         < result > /result.jsp </ result >
                         < result name = "add" > /{2}. jsp </ result >
                         < result name = "update" > /{2}. jsp </ result >
                 </ action >
         </ package >
</ struts >  
 
Three tests

 



 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326837636&siteId=291194637