struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jorge Martín Cuervo <darthk...@gmail.com>
Subject Re: the right way?
Date Fri, 19 May 2006 06:47:35 GMT

El 19/05/2006, a las 1:23, Paul Benedict escribió:

> This looks right to me. Except you don't put any objects
> in the request. Remember, setting redirect="true" creates a new
> HTTP request and those parameters will not pass to the next page.
> -- Paul
>

i know how the redirect="true" attribute works. Thanks for the advise.
And yes, theres no putting objects code in the above message. Only a  
comment in place...

/*
  * load the data to request
  */


thanks again.

> --- Jorge Martín Cuervo <darthkorr@gmail.com> wrote:
>
>> 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 <jorge@martincuervo.com>
>>   *
>>   */
>> 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: jorge@martincuervo.com
>> voz: +34 660 026 384
>> ----------------------------------------------
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

----------------------------------------------
Jorge Martín Cuervo

email: jorge@martincuervo.com
voz: +34 660 026 384
----------------------------------------------



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message