The problem is: When he pass through interceptor and go to action "cadastrarOrdemServico" my var cdProjetoOS are set with null :(

thanks, follow my all code:

CLASS LoginClienteInterceptor .java
---------------------------------------------------
package br.com.dnasolution.site.interceptor;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;

public class LoginClienteInterceptor implements Interceptor {

@Override
public void destroy() { }
@Override
public void init() { }

@Override
public String intercept(ActionInvocation invocation) throws Exception {
if(invocation.getInvocationContext().getSession().get("clienteLogado") != null){
  return invocation.invoke();
 }else{
  return "clienteNaoLogado";
 }
}

}
----------------------------------------------------
Class LoginUsuarioInterceptor
----------------------------------------------------
package br.com.dnasolution.site.interceptor;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;

public class LoginUsuarioInterceptor implements Interceptor {

@Override
public void destroy() {}

@Override
public void init() { }

@Override
public String intercept(ActionInvocation invocation) throws Exception {
if(invocation.getInvocationContext().getSession().get("usuarioLogado") != null){
  return invocation.invoke();
 }else{
  return "usuarioNaoLogado";
 }
}

}
----------------------------------------------------
My STruts.xml
----------------------------------------------------
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd";><struts>
<package name="my-secure"
   extends="convention-default">
 <interceptors>
  <interceptor name="loginUsuarioInterceptor"
      class="br.com.dnasolution.site.interceptor.LoginUsuarioInterceptor">
  </interceptor>
  <interceptor name="loginClienteInterceptor"
      class="br.com.dnasolution.site.interceptor.LoginClienteInterceptor">
  </interceptor>
  <interceptor-stack name="secureStack">
   <interceptor-ref name="defaultStack"/>
   <interceptor-ref name="loginClienteInterceptor"/>
   <interceptor-ref name="loginUsuarioInterceptor"/>
  </interceptor-stack>
 </interceptors>

 <default-interceptor-ref name="secureStack"/>

 <global-results>
  <result name="clienteNaoLogado">/jsp/usuario/loginUsuario.jsp
  </result>
  <result name="clienteNaoLogado">/jsp/cliente/loginCliente.jsp
  </result>
 </global-results>

</package>
</struts>
----------------------------------------------------
My OrdemServicoAction.java
----------------------------------------------------


package br.com.dnasolution.site.action;

import java.util.Date;
import java.util.List;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.InterceptorRef;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;


import com.opensymphony.xwork2.ActionContext;

@ParentPackage("my-secure")
public class OrdemServicoAction {
@Action(value = "cadastrarOrdemServico", results = {
@Result(name = "valido", location = "/jsp/ordemservico/cadastro_sucesso.jsp"), @Result(name = "invalido", location = "/jsp/ordemservico/cadastro_falha.jsp") }, interceptorRefs = { @InterceptorRef("loginClienteInterceptor") })
public String cadastrarOrdemServico() {
 try {
  TbProjeto projetoOS = projetoService
    .getProjetoById(this.cdProjetoOS);
  TbTopicoOs topicoOs = topicoOsService.getTopicoById(cdTopicoOS);

}

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to