0

JSP文件--->

<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>

动作类--->

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 文件中正确地给出了动作路径??我的动作课在“com.hr.action”下

4

1 回答 1

0

您需要将您的操作映射到 struts config xml 中的 URL。检查 struts config xml 以获得正确的映射

于 2014-04-15T14:55:10.573 回答