For example: I set up an SSH project demo, the project structure as shown in the following diagram:
This project has a login interface, there is a login.jsp file, this file form form request is as follows
<body>
This form can also be written in this form
<body>
Configure the response action path in Struts-config.xml as follows
<struts-config>
<form-beans>
<form-bean name= "Employeeform" type= " Com.gt.web.forms.EmployeeForm "></form-bean>
</form-beans>
<action-mappings>
<action path= "/login" parameter= "flag" name= "Employeeform" type= "com.gt.web.action.LoginAction" >
< Forward name= "OK" path= "/web-inf/mainframe.jsp" ></forward>
<forward name= "error" path= "/web-inf/ login.jsp "></forward>
</action>
</action-mappings>
</struts-config>
Here we find that the first URL path can be used in the form, this is the absolute path of the writing, the second is a relative path, do not need to write a slash, the system by default is the project, in this project is/ssh ("SSH" for the project name) below.
There is also a third way of writing, which is to use Request.getcontextpath () to get the project root path
<body>