[Ajuda] Integração com Spring e Struts

0 respostas
InsaneChess

Prezados, boa tarde.
Alguem pode me ajudar a realizar a integração a baixo?

Segue a parte importante do spring-config.xml:

<bean id="ControleBean" class="br.com.murah.controle.Controle">
        <property name="pHD">
            <ref local="projHibDao" />
        </property>
    </bean>

<!--  "A Action que quero integrar segue abaixo" -->
<bean name="/listarProjeto" class="br.com.murah.action.ListarProjetoAction">
        <property name="controle">
            <ref local="ControleBean" />
        </property>
    </bean>

Segue a parte importante do struts-config.xml:

<action path="/listarProjeto"
            type="org.springframework.web.struts.DelegatingActionProxy" name="ListarProjetoForm">
            <forward name="sucesso" path="/index.jsp" />
        </action>

E por fim, a action:

package br.com.murah.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import br.com.murah.controle.Controle;
import br.com.murah.gerencia.Projeto;


public class ListarProjetoAction extends Action {
	
	  Controle controle;
	public Controle getControle() {
		return controle;
	}
	public void setControle(Controle controle) {
		this.controle = controle;
	}
	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
        
		
		List<Projeto> listaProjetos = controle.consultarDados();

		request.setAttribute("listaProjetos", listaProjetos);
		return mapping.findForward("sucesso");
	}
}

Alguem pode realmente me ajudar como devo realizar essa integração?
Está ocorrendo o erro de "Servlet action is not available"...

Eu tentei a alguns dias vários tutoriais...só que não estou conseguindo...
Obrigado de coração pela atenção de vocês.
Uma ótima semana!

Criado 21 de outubro de 2010
Respostas 0
Participantes 1