Salve a tutti sto cercando di utilizzare la DispatchAction di struts.
Ho creato una mia action in questo modo:
package com.test.dispatchAction;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;
public class CreditAction extends DispatchAction{
public ActionForward reject(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
String id = request.getParameter("id");
//logic to reject the application with the above id
return mapping.findForward("reject-success");
}
public ActionForward approve(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
String id = request.getParameter("id");
//logic to reject the application with the above id
return mapping.findForward("approve-success");
}
public ActionForward addComment(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
String id = request.getParameter("id");
//logic to reject the application with the above id
return mapping.findForward("viewDetails");
}
}
IN STRUTS-CONFIG HO FATTO L'ACTION MAPPING
<action-mappings>
<action path="/Welcome" forward="/welcomeStruts.jsp"/>
<action path="/gestioneApp" type="com.test.dispatchAction.CreditAction" input="/ListCreditApplications.jsp" parameter="step" scope="request" validate="false" >
<forward name="reject-success" path="RejectAppSuccess.jsp" redirect="true" />
<forward name="approve-success" path="ApproveAppSuccess.jsp" redirect="true" />
<forward name="viewDetails" path="ViewDetails.jsp" redirect="true" />
</action>
</action-mappings>
ora cercando di far partire il mio index.jsp:
...
<body>
<html:form action="/gestioneApp">
<html:submit property="step">Update</html:submit>
<html:submit property="step">Delete</html:submit>
</html:form>
</body>
...
mi da questo errore:
exception
javax.servlet.ServletException: Cannot retrieve definition for form bean null on action /gestioneApp
org.apache.jasper.runtime.PageContextImpl.doHandle PageException(PageContextImpl.java:848)
org.apache.jasper.runtime.PageContextImpl.handlePa geException(PageContextImpl.java:781)
org.apache.jsp.index_jsp._jspService(index_jsp.jav a:84)
org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
org.netbeans.modules.web.monitor.server.MonitorFil ter.doFilter(MonitorFilter.java:362)
sembra che si vada a cercare l'ActionForm e non lo trova e da errore.
Scusate sono all'inizi con struts. Però mi sembra d'aver capito che la classe per mantenere i dati posso anche non metterla.. ho provato a mettenre 1 e specificarla con "name" in struts-config solo che m da sempre lo stesso errore (cambia null col nome della classe specificata)
Sapete a cosa può essere dovuto
grazie!