SSH framework jsp file access error 404 Times

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/cxh6863/article/details/88902897

problem

Error message shown:
Here Insert Picture Description
404 error usually occurs because the file can not be found, so be sure to pay attention to some questions about the configuration file path, the path must correspond, if there is no corresponding, 404 occurs. But I came to this 404 error, not because the path configuration issue, but a very strange question, I have a place to extend the inheritance, there is a problem.

Solution

1, looking in the wrong, what is wrong

We must first learn the wrong, how to see what is wrong, this is the most important, I do not even know what's wrong, just know that 404 is not enough, the 404 covers a lot of mistakes. Tomcat server running from the controller seen, looking Caused by, behind it is the problem to be solved.
I find wrong is the Parent package is not defined: struct- default, as shown in FIG.
Here Insert Picture Description

2, find the corresponding file wrong

Struct generally we see the word, thought to see the profile struct.xml, of course, really do not know, you can search directly for full project.
Then find struct-default file from struct.xml
Here Insert Picture Description

3, change the error

The first case

This situation is exactly the situation I encountered due to clerical error
will change struct-default struts.xml file for either the struts-default
Here Insert Picture Description

The second case

May not be introduced into the corresponding jar package
incorporated struts2-json-plugin-2.3.15.3.jar package, of course, also be other editions.
Here Insert Picture Description

The third case

If the top two kinds of writing there are no errors, but also introduced a jar package or not, you can extends another, is json-default
Here Insert Picture Description

to sum up

Through this resolve this error, found on the struts have inherited struts-default and json-default, then maybe has what difference does it make? After some review, the original json-default inherited struts-default, which is primarily to achieve json struts2 and combined, the json plugin is to achieve struts2 struts2 and combine the json.

Guess you like

Origin blog.csdn.net/cxh6863/article/details/88902897