简体   繁体   中英

404 happen when using redirect result type in Struts2 (to redirect from one jsp to another)

I am a very beginner of Struts2 and is following the tutorial provide by tutorialspoint. Currently I am testing the code provided: Struts 2 - Redirect Action .

However, when I click the "Say Hello" button, I get 404 error.

There are two question I would like to ask:

  1. What would be the better way to learn Struts2's redirect result type?
  2. Would the version of struts2 cause the 404 error?
  3. Anything miss in the code provided by tutorialspoint?

As the code are just copy of the tutorialspoint, I am not going to provide it here.

What would be the better way to learn Struts2's redirect result type?

Redirect Result

Would the version of struts2 cause the 404 error?

The cause is not defined but framework returns 404 if the action name determined in the url is not mapped. See this if you need to learn why 404 is returned.

Anything miss in the code provided by tutorialspoint?

WebContent/WEB-INF/classes/struts.xml is bad location of configuration file. Use /src/struts.xml .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM