Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Programming \ struts2 completely the wrong way to capture 404     - Linux C programming and Shell Programming in the development of practical tools similarities summary (Programming)

- To install the Git and Github under Ubuntu (Linux)

- Install Ubuntu text editor KKEdit 0.2.10 (Linux)

- Sshuttle A VPN-based transparent proxy that uses ssh (Server)

- Ubuntu / Fedora / CentOS system how to install Plex Media Server 0.9.9 (Linux)

- Windows environment Android Studio v1.0 Installation Guide (Linux)

- Linux common commands ll namely ls -l --color = auto (Linux)

- Share Practical Tutorial GitHub (Linux)

- Linux ban single-user mode to enhance system security (Linux)

- PostgreSQL 9.3.5 database installation under Ubuntu Server 14.04 (Database)

- CentOS yum source configuration (Linux)

- Java implementation chain store binary tree (Programming)

- Linux and hardware (Linux)

- Network traffic monitoring ntopng (Linux)

- Unix average load average load calculation method (Server)

- 15 things to do after installing Ubuntu 15.04 Desktop (Linux)

- Linux System Administrator common interview questions and answers 30 (Linux)

- SecureCRT use the configuration detailed tutorial (Linux)

- CentOS / Linux install VNC Server (Linux)

- error no.2013 lost connection Tom with SQLServer during query (Database)

  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.
- Resolve the host via KVM console can not connect clients (Linux)
- VMware virtual machines to install virt-manager unable to connect to libvirt's approach (Linux)
- How to customize your Linux desktop: Gnome 3 (Linux)
- Oracle JDK installation under Ubuntu Linux (Linux)
- Python in yield (Programming)
- Ubuntu derivative version of the user and how to install SmartGit / HG 6.0.0 (Linux)
- Tomcat installation under Linux (Server)
- and localhost difference (Server)
- Linux shell scripts bubble sort (Programming)
- ORA-01000 Solution (Database)
- Zabbix monitoring tool deployment under Ubuntu server (Server)
- Python-- for anomalies and reflection of objects articles (Programming)
- RAID disk array Description (Linux)
- Expand an existing RAID arrays and remove the failed disk in a RAID (Linux)
- Linux server remote user to obtain root privileges prevention (Linux)
- Linux administrator should command: sed and awk (Linux)
- BGP routers want to play it by CentOS (Linux)
- Ubuntu 14.04 installed NVIDIA graphics driver (Linux)
- Yii PHP Framework Getting Started tutorial (Linux)
- Use FFmpeg processing high quality GIF (Programming)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.