About SpringMVC related knowledge points record

I just started to learn the SpringMVC framework recently, and there are a lot of things I don’t understand. Now I’ll record the ones I don’t understand for future reference.

 

1. About requestmapping path mapping

The value value in requestmapping is essentially the port through which the front-end jsp file accesses the controller. The front-end finds the same value in the controller and accesses the method

To access the files in the webroot directory, you can directly use /.. (name) in the controller controller to access, but if you put the Jsp file in the folder, you need to add the folder name in the controller controller

The jsp file is placed in the test folder

The following is the code in the controller controller

public static final String SUCCESS = "success";
	@RequestMapping("/test/helloworld")
	public String pick() {
		System.out.println("这是实体页面");
		return SUCCESS;
	}

Below is the code in jsp

<a href="helloworld">TEST CONTROLLER</a>

Run successfully

Guess you like

Origin blog.csdn.net/qq_36409988/article/details/83660109