Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Programming \ struts2 completely the wrong way to capture 404     - Ubuntu 14.04 Enable root and disable the guest (Linux)

- Linux Network Programming - signal blocking and shielding (block, unblock) (Programming)

- Linux Log File Browser --logrotate (Linux)

- Github with .gitignore ignore specified file (Linux)

- How to monitor network usage by nload in Linux (Linux)

- How to add any of a Linux distribution beautiful fonts (Linux)

- to compile FFmpeg In Ubuntu (Linux)

- Achieve camera preview by ffplay (Linux)

- The REVERSE function of DB2 (Database)

- MySQL partition summary (Database)

- CentOS 6.4 OpenNebula installation (Linux)

- Ubuntu 14.10 / 14.04 / 12.04 How to install Kodi 14.0 RC3 (Linux)

- To remove those IP is prohibited Fail2ban on CentOS 6/7 (Server)

- Linux directory structure (Linux)

- C ++ why we chose to use the smart pointer (Programming)

- Use smartmontools view the health status of hard disk (Linux)

- Ubuntu way of decompressing files (Linux)

- Vi / Vim prompt solutions do not have permission to save time (Linux)

- vector C ++ sequence containers (Programming)

- Debian 8 Jessie install LAMP server tutorial (Server)

  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.
- CentOS 6.4 of cron scheduled task configuration (Linux)
- How to make GRub instead of the default Ubuntu software center (Linux)
- CentOS 6.6 installation certification system based on the ftp service (Server)
- Linux ./configure --prefix command (Linux)
- Linux FAQ - How to fix tar:Exitingwith failure status due to previous errors (Linux)
- MySQL query plan key_len know all (Database)
- Ubuntu 14.04 Trusty Tahr User How to install Banshee 2.9.1 (Linux)
- How to add a new resolution VirtualBox (Linux)
- ARM runtime environment built from scratch using QEMU emulator (Linux)
- MySQL to NoSQL avatar (Database)
- Java Access Control (Programming)
- Android custom ViewPager create kaleidoscopic image transition effects (Programming)
- HDFS Distributed File System Resource Manager Developer summary (Server)
- Install the Red Hat Container Development Kit on OSX (Server)
- Java objects to garbage collection (Programming)
- Ubuntu installation under Scrapy (Linux)
- Linux module mechanism of (Programming)
- Linux basic introductory tutorial ---- simple text processing (Linux)
- Restrict console access to Linux servers to improve security (Linux)
- Python extension module Ganglia 3.1.x (Linux)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.