This is the code of one of my interceptors:
package es.uv.lisitt.dtx2.configuraciontool.web;
import java.util.Map;
import org.apache.log4j.Logger;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.ValidationAware;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
import es.uv.lisitt.dtx2.utilidades.Errores;
public class NuevaSuscripcionP1Interceptor extends AbstractInterceptor {
private static final long serialVersionUID = 1L;
/**
* Datos de Logger
*/
static Logger log =
Logger.getLogger(NuevaSuscripcionP1Interceptor.class);
public String intercept(ActionInvocation invocation) throws Exception {
String fechaInicio = null;
String horaInicio = null;
String fechaFin = null;
String horaFin = null;
Map<String,String[]> parameters;
try{
parameters = ActionContext.getContext().getParameters();
fechaInicio = parameters.get("fechaInicio")[0];
if(fechaInicio.equalsIgnoreCase("")){
fechaInicio = null;
}
horaInicio = parameters.get("horaInicio")[0];
if(horaInicio.equalsIgnoreCase("")){
horaInicio = null;
}
fechaFin = parameters.get("fechaFin")[0];
if(fechaFin.equalsIgnoreCase("")){
fechaFin = null;
}
horaFin = parameters.get("horaFin")[0];
if(horaFin.equalsIgnoreCase("")){
horaFin = null;
}
if ((fechaInicio!=null) || (fechaFin!=null) ||
(horaInicio!=null) ||
(horaInicio!=null) ){
if ((fechaInicio==null) || (fechaFin==null) ||
(horaInicio==null) ||
(fechaInicio==null) ){
addActionError(invocation,"Para
introducir las fechas debe rellenar
todos los campos obligatoriamente");
if((fechaInicio==null)||(fechaInicio.equalsIgnoreCase(""))){
addFieldError(invocation,
"fechaInicio", "");
}
if((horaInicio==null)||(horaInicio.equalsIgnoreCase(""))){
addFieldError(invocation,
"horaInicio", "");
}
if((fechaFin==null)||(fechaFin.equalsIgnoreCase(""))){
addFieldError(invocation,
"fechaFin", "");
}
if((horaFin==null)||(horaFin.equalsIgnoreCase(""))){
addFieldError(invocation,
"horaFin", "");
}
return Action.INPUT;
}
}
}catch (Exception e) {
log.error(e);
log.error(Errores.formateaPila(e.getStackTrace()));
}
return invocation.invoke();
}
private void addActionError(ActionInvocation invocation, String
message) {
Object action = invocation.getAction();
if(action instanceof ValidationAware) {
((ValidationAware) action).addActionError(message);
}
}
private void addFieldError(ActionInvocation invocation, String
field,String
message) {
Object action = invocation.getAction();
if(action instanceof ValidationAware) {
((ValidationAware) action).addFieldError(field,
message);
}
}
}
Lukasz Lenart wrote:
>
> 2008/11/25 Tomi21 <[EMAIL PROTECTED]>:
>> These interceptors are not configured for 'EliminarSuscripcion' action.
>> If interceptors have something to do with this issue only the ones
>> defined
>> in the default stack
>> are concerned.
>
> Yes, but I must look in to the Struts2 source to check how the
> interceptors are created. Maybe that can be somehow related to your
> problem.
>
>
> Regards
> --
> Lukasz
> http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/Struts2-2.0.11-problem-with-url-and-parameters-tp20577582p20680636.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]