Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Programming \ struts2 completely the wrong way to capture 404     - Elaborate .NET Multithreading: Thread Pool (Programming)

- namespace mechanism Linux kernel analysis (Linux)

- Docker Build a Java compiler environment (Linux)

- Enterprise Encrypting File System eCryptfs Comments (Linux)

- Seven kinds of NIC binding mode Detail (Linux)

- Linux virtual memory and physical memory (Linux)

- 64 Ubuntu 15.04 Linux kernel upgrade to Linux 4.1.0 (Linux)

- Introduction and use of the Raspberry Pi (Linux)

- ORA-00600: internal error code, arguments: [keltnfy-ldmInit], [46], [1], [], [], [], [], [] (Database)

- Oracle 11g creates virtual private directory RMAN-06004 ORA-00942 error handling (Database)

- Sublime Text 3 (Linux)

- Linux Log (Linux)

- Ubuntu 12.04 installation NVIDIA GTX750 graphics driver (Linux)

- GitLab upgrade to 8.2.0 (Linux)

- Ubuntu 14.04 and derivative versions of the user install Pantheon Photos 0.1 (Linux)

- Docker manage data (Linux)

- JDK comes with tools JPS (Linux)

- Oracle 11g maintenance partitions (Seven) - Modifying Real Attributes of Partitions (Database)

- SSH configuration under Linux (Linux)

- Is Linux the most secure operating system (Linux)

  struts2 completely the wrong way to capture 404
  Add Date : 2018-11-21      
  Currently doing a web application, struts2 + spring + hibernate, server is tomcat. We want users in the IE address bar Luanqiao when all undefined URL that can be typed into the capture process, then go to a home-made 404 error handling page.

First, access to online information that can be added in web.xml so:

< Error-page>
  < Error-code> 404 < / error-code>
  < Location> /error/404.jsp < / location>
< / Error-page>

Thus, it is not found 404 error will go /error/404.jsp accept the deal.

But after testing, I found that the end of the URL .action struts2 framework will first be captured, not directly into web.xml configured handle page. Thus, if the appropriate action is not configured in struts.xml, an error is output in the tomcat:

Serious: Could not find action or result
There is no Action mapped for namespace / and action name ****** -. [Unknown location]

While the final configuration can be transferred to the web.xml processing page, but this blind at the command station output something very easy to program and debug management, so I have to find ways to deal with struts2 framework undefined action.

Access to online information, can be found in struts.xml, add a default package, then this default package, add a default action, so that the action turned 404 error handling page:

< Package name = "default" extends = "struts-default">
  < Default-action-ref name = "notFound" />
  < Action name = "notFound">
    < Result> /error/404.jsp < / result>
  < / Action>
< / Package>

The default package feature is that you do not define namespace attribute, so all undefined namespace will turn here. name = "default" is for ease of reading, in fact, is what the name can also be empty: name = "".

And then also in the other package has been defined also add the default action, turn to page 404 error handling. So that it can fully handle all the 404 errors.
- Linux Operating System Security Management describes the top ten tricks (Linux)
- Parameters of the extra port MySQL 5.6 (Database)
- command-line tool for send e-mail (Linux)
- mysql_config_editor encryption and decryption of the new features of MySQL realization (Database)
- Linux kernel TCP / IP parameters analysis and tuning (Linux)
- Web cache basics: terminology, HTTP headers, and caching policies (Server)
- Linux server alarms using Java (Server)
- How to add a new hard disk without restarting the CentOS 7 / RHEL 7 virtual machine (Linux)
- Installation and operation GAMIT software under Linux operating system (Linux)
- Java to create a table in the database SYBase (Database)
- Hibernate Search 5.5 in the search results sorted (Linux)
- CentOS 6.4 install and configure Squid Proxy Server (Linux)
- C ++ 11 feature: auto keyword (Programming)
- How to implement Linux host Telnet SSH password Free (Server)
- JavaScript file loader LABjs API Explanation (Programming)
- Using Linux strace command trace / debug a program commonly used options (Linux)
- OpenSSL for secure transmission and use of skills of files between Windows and Linux (Linux)
- HBase table data processing tab (Database)
- Spring Data study notes -Helloworld (Programming)
- Search Linux commands and files - which, whereis, locate, find (Linux)
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.