Я использую Struts 1, когда я пытаюсь открыть любой файл jsp
, он показывает ошибку:
HTTP Status 500 - No action instance for path /page could be created
Это моя форма действия
public class DispatchActionForm extends org.apache.struts.action.ActionForm {
private String parameter;
public String getParameter()
{
return "param";
}
public void setParameter(String parameter)
{
this.parameter=parameter;
}
}
Вот мой класс действий:
public class DispatchAction extends DispatchActionForm {
public ActionForward add(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse resp) throws Exception
{
DispatchActionForm f = (DispatchActionForm) form;
return mapping.findForward("add");
}
public ActionForward edit(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)throws Exception
{
return mapping.findForward("edit");
}
public ActionForward remove(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception
{
return mapping.findForward("remove");
}
}
Вот мой файл конфигурации strut truts-config.xml
:
</form-beans>
<action-mappings>
<action name="DispatchActionForm" path="/page" type="com.myapp.struts.DispatchAction"
input="/index.jsp" parameter="parameter" scope="request" validate="false">
<forward name="add" path="/add.jsp"/>
<forward name="edit" path="/edit.jsp"/>
<forward name="remove" path="/Remove.jsp"/>
</action>
</action-mappings>
и index.jsp
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<html:link page="/page.do?parameter=add">Add</html:link><br>
<html:link page="/page.do?parameter=edit">Edit</html:link><br>
<html:link page="/page.do?parameter=remove">Remove</html:link><br>