Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ struts2 completely the wrong way to capture 404     - Ora-1092: OPI colleague K aborting process --- killed by OO Well killer (Database)

- How comprehensive resist attacks from the network (Linux)

- systemd run levels and service management command Introduction (Linux)

- To install the latest version of Shotwell 0.18 under Ubuntu (Linux)

- Linux, Chrome browser font settings beautification (Linux)

- Binary Packages Golang (Linux)

- Iptables principle (Linux)

- X security settings in Ubuntu (Linux)

- Windows Ubuntu dual system a key Ghost, grub rescue prompt solution (Linux)

- Apache Tomcat integration and resin (Server)

- HTTP Client Hints Introduction (Server)

- Go powerful development server simple example (Server)

- Linux system boot process ARM platforms (Linux)

- Learn to read the source code of vmstat (Linux)

- MySQL 5.6.26 source install (Database)

- C # socket udp broadcast (Programming)

- Install Ubuntu text editor KKEdit 0.2.10 (Linux)

- To install Docker under Ubuntu 15.04 (Linux)

- Installation and deployment of MariaDB under CentOS (Database)

- How to install and use the malware detection tool LMD and ClamAV antivirus engine on Linux (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.
     
         
         
         
  More:      
 
- Oracle database, some basic grammatical structures (Database)
- Linux scheduling summary (Linux)
- RabbitMQ tutorial examples: RabbitMQ installation under Windows (Linux)
- How to update the ISPConfig 3 SSL Certificates (Server)
- How to write a new Git protocol (Linux)
- Java object initialization (Programming)
- How do you access Dropbox Linux command line (Linux)
- Workaround CentOS error message during compilation PHP5 common (Linux)
- Ubuntu font settings: Using Windows Font (Linux)
- Linux system security mechanisms to share (Linux)
- Oracle 12c users create (Database)
- Hadoop 0.23 compile common errors (Server)
- C ++ Supplements --new delete overload (Programming)
- Commentary Apache + Tomcat + JK implement Tomcat clustering and load (Server)
- How to install the Ruby runtime environment on Mac OS X (Linux)
- Ora-1092: OPI colleague K aborting process --- killed by OO Well killer (Database)
- The difference Docker save and export commands (Linux)
- Integrated security administrator Linux accident management (Linux)
- ORA-38856: Unable instance UNNAMED_INSTANCE_2 (redo thread 2) marked enabled (Database)
- Ubuntu 14.04.1 LTS compile and install the new kernel (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.