Skip to content

Commit

Permalink
fix: changed the mapping approach to fix the 404 errors caused by str…
Browse files Browse the repository at this point in the history
…uts2 mapping

- This will allow struts2 to support multiple types of url (.do, .action)
- Exclude static resources to avoid any performance issue
  • Loading branch information
kateyang1998 committed Mar 10, 2025
1 parent cb6503e commit f8aa20b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/main/webapp/WEB-INF/classes/struts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<constant name="struts.action.extension" value="do" />
<constant name="struts.objectFactory" value="spring"/>
<constant name="struts.enable.SlashesInActionNames" value="true" />
<constant name="struts.serve.static" value="true" />
<constant name="struts.serve.static.browserCache" value="true" />
<constant name="struts.action.excludePattern" value=".*\.(css|js|png|jpg|gif)$" />
<!-- Default package extending struts-default -->
<package name="default" namespace="/" extends="struts-default">
<action name="logout" class="oscar.login.Logout2Action">
Expand Down
4 changes: 3 additions & 1 deletion src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.do</url-pattern>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<filter>
<filter-name>WebServiceSessionInvalidatingFilter</filter-name>
Expand Down

0 comments on commit f8aa20b

Please sign in to comment.