JSP FIle --->
<html:form method="post" action="/createEmployee">
<p><font color="red">*</font>First Name</p>
<p><html:text property="firstName" /></p>
<p><font color="red">*</font>Last Name</p>
<p><html:text property="lastName" /></p>
<p><font color="red">*</font>Birth Date</p>
<p><html:text property="birthDate" value="" /></p>
<p><font color="red">*</font>Salary</p>
<p><html:text property="salary" /></p>
<p><font color="red">*</font>Organization</p>
<p><html:text property="organization" /></p>
<p><input type="submit" value="Save" name="submitBtn" /></p>
<p><input type="reset" value="Cancel" name="cancelBtn" /></p>
</html:form>
行动类---&gt;
public ActionForward excute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
{
System.out.println(request.getParameter("msg"));
EmployeeForm employeeForm = (EmployeeForm)form;
OrganizationServiceImpl organizationService = new OrganizationServiceImpl();
long organizationId = organizationService.getOrganizationByName(employeeForm.getOrganization());
employeeForm.setOrganization_id(organizationId);
EmployeeServiceImpl employeeService = new EmployeeServiceImpl();
long employeeId = employeeService.creatEmployee(employeeForm);
request.setAttribute("employeeId", employeeId);
return mapping.findForward("createEmployee");
}
我想知道我是否在我的jsp文件中正确地给出了Action路径? 我的动作类在“com.hr.action”
下答案 0 :(得分:0)
您需要将操作映射到struts config xml中的URL。检查struts config xml是否有正确的映射