In the structs2 framework, each jsp performs ahref .. when referenced by a, the addresses in href are relative to the current action. In this way, when the project architecture is changed, the referenced path also needs to be changed, which is inconvenient. therefore, we recommend that you use absolute path when using the path: % Stringpathrequest must be added to the jsp file. getContextPath ()
In the structs2 framework, each jsp performs a href = .. when/a references, the addresses in href are relative to the current action. In this way, when the project architecture is changed, the referenced path also needs to be changed, which is inconvenient. therefore, we recommend that you use absolute path when using the path: % String path = request must be added to the jsp file. getContextPath ()
In the structs2 framework, when each jsp file is referenced, the address in href is relative to the current action. In this way, when the project architecture is changed, the referenced path is also changed, which is inconvenient.
Therefore, we recommend that you use the absolute path when using the path:
Add the following to the jsp file:
<% String path=request.getContextPath(); String basepath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%>
This basepath representsCurrent Project.
If you want to access the path. action under the current project path/, you only need the following code:
<% @ Page language = "java" contentType = "text/html; charset = GB18030" pageEncoding = "GB18030" %><% String path = request. getContextPath (); String basepath = request. getScheme () + ": //" + request. getServerName () + ":" + request. getServerPort () + path + "/"; %>
Insert title here= "<% = Basepath %>Path/path. action "> path Problems