Solve problems encountered in server-side development

Error screenshot from Eclipse

in solving this problem

1. The first feeling may be caused by this code

<%String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

This statement is used to assemble the relative path of the current web page.

<base href="..."> is used to indicate the root path used by the relative path of the current page. For example, if there is a link inside the page, the full path should be http://localhost:80/myblog/authen/login.do. Where http://server/ is the base path of the server and myblog is the name of the current application, then, my root path should be http://localhost:80/myblog/.

After having this <base ... >, I don't want to write the full path to the connection of my page content, I just need to write authen/login.do. The server will automatically assemble the path specified by <base ...> and the relative path in the page to form a complete path. If there is no <base...>, then the link of my page must write the full path, otherwise the server will not find it.

request.getSchema() can return the protocol used by the current page, which is "http" in the above example. request.getServerName() can return the name of the server where the current page is located, which is "localhost" in the above example. request.getServerPort() can Returns the port used by the server where the current page is located, which is 80. request.getContextPath() can return the name of the application where the current page is located, which is myblog in the above example. These four assembled together are the path of the current application.

Unfortunately not

2. I saw a method on the Internet: start the task manager -> end the javaw.exe processtask manager

I didn't expect it to be really useful! Out!

Enter image description

I struggled for a long time before, thinking that my server had crashed, so I was very aggrieved when I copied and pasted the project for an afternoon. It's all my fault that I didn't find the solution on the Internet for the first time, made many detours, and I haven't seen where javaw.exe is (stupidly crying myself). So newbies are best not to trust themselves too much, and sometimes very simple mistakes can't be solved.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325951637&siteId=291194637