Hi all,
i have the problem to populate request with data with validation. If
the validation process causes errors, the flow never arrives to
Action processing and no objets in request were send to jsp.
I've solved but i'm not sure if that is the correct way.
Can anyone take a look?
thanks
[...]
<action path="/Employer"
type="com.defactops.smartcvweb.struts.action.EmployerAction"
name="employer"
validate="false"
input="smartcv.employer"
parameter="view,save,default=view">
<forward name="view" path="smartcv.employer"/>
<forward name="success" path="/SearchMap.do" redirect="true"/>
</action>
[...]
/*
* $Id: EmployerAction.java,v 1.1 2006/05/18 17:17:54 jorge Exp $
* $Log: EmployerAction.java,v $
* Revision 1.1 2006/05/18 17:17:54 jorge
* prueba employer
*
*/
package com.defactops.smartcvweb.struts.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.EventActionDispatcher;
import com.defactops.smartcvweb.struts.actionform.EmployerForm;
/**
*
* @author Jorge Martin Cuervo <[EMAIL PROTECTED]>
*
*/
public class EmployerAction extends BaseAction {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws
Exception {
EventActionDispatcher dispatcher = new
EventActionDispatcher(this);
return dispatcher.execute(mapping, form, request, response);
}
public ActionForward view(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws
Exception {
return mapping.findForward("view");
}
public ActionForward save(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws
Exception {
/*
* load the data to request
*/
ActionErrors errors = ((EmployerForm)form).validate(mapping,
request);
addErrors(request, errors);
if (errors.isEmpty()) {
return mapping.findForward("success");
} else {
return mapping.getInputForward();
}
}
}
----------------------------------------------
Jorge Martín Cuervo
email: [EMAIL PROTECTED]
voz: +34 660 026 384
----------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]