Struts2 Postfix - Deep Dive into Struts2

One change the action suffix to the html suffix
<? 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 >
         < include file = "helloworld.xml" ></ include >
         < constant name = "struts.action.extension" value = "html" ></ constant >
         < constant name = "struts.enable.DynamicMethodInvocation" value = "false" ></ constant >
</ struts >  
 
Second test


 
 
Three remove the action suffix
<? 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 >
         < include file = "helloworld.xml" ></ include >
        <!-- If you do not configure the following sentence, you can also remove the suffix to access -->
         < constant name = "struts.action.extension" value = "" ></ constant >
         < constant name = "struts.enable.DynamicMethodInvocation" value = "false" ></ constant >
</ struts >
 
Four tests


 
 
Five three ways to configure suffix
1. Configure in struts.xml
< constant name = "struts.action.extension" value = "html" ></ constant >
2. Configure in struts.properties, and you can configure multiple suffixes
struts.action.extension=action,do,struts2,
3. Configure in web.xml

 



 

Guess you like

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