File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

issues in calling the ejbcontroller (EJB 3.o ) from the controller using spring Frame

prajesh kunimal
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am new to Spring framework.right now in our project we are working in spring framewok(Mvc Architecture layer).
The issues which i am facing here is i don't know how to call the "EJB CONTROLLER"(which is another layer) from the controller (which is nothing but the servlet) using the "Spring Framwork"

can anybody guide me to foundout the solution for this issue.So that i can proceed further.....Below are the details of my codings

package com.trctc.login.controller;

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

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractCommandController;
import org.springframework.validation.*;

import com.trctc.login.dto.LoginDTO;
import com.trctc.login.ejbctrl.LoginEJBCtrl;
import com.trctc.login.form.LoginForm;
import org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean;

//import com.trctc.login.form.LoginForm;

* Servlet implementation class for Servlet: LoginController
public class LoginController extends AbstractCommandController{
/* (non-Java-doc)
* @see javax.servlet.http.HttpServlet#HttpServlet()

private LoginBD loginBD;

public LoginController() {

protected ModelAndView handle(HttpServletRequest request, HttpServletResponse response, Object command, BindException error) throws Exception {
try {

System.out.println("Control in Controller");
LoginDTO loginDTO = new LoginDTO();
LoginForm loginForm=(LoginForm)command;
System.out.println("Value of User name : " + loginForm.getUsername());
System.out.println("Value of Password : " + loginForm.getPassword());
System.out.println("Value of User name : " + loginDTO.getUserName());
System.out.println("Value of Password : " + loginDTO.getPassword());
//Variable userFlag holds the status of the user.
String userFlag = "Fail";
userFlag = loginBD.verifyLogin(loginDTO);
//LoginBD loginBD = null;
/*Logindelegate logindelegate=new Logindelegate();

System.out.println("user Status.."+userFlag);
} catch (Exception e) {
System.out.println("Exception in Controller");
return new ModelAndView("welcome.jsp");

public void setLoginBD(LoginBD loginBDImpl){


TRCTC_Servlet.xml Dispatcher File for the Springs)
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""

<!-- the application context definition for the springapp DispatcherServlet -->
<!-- <bean name="/hello.htm" class="springapp.web.HelloController" /> -->

<bean name="/login.trs"
<property name="loginBD" ref="loginBDImpl" />
<bean id="loginBDImpl" class="" />

<!--<bean id="loginEJBCtrl" class="">
<property name="loginEJBCtrl" ref="LoginEJBref" />

<bean id="LoginEJBref" class="org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean">
<property name="jndiName" value="ejb.LoginSLEJBRemoteHome"/>
<property name="businessInterface" value="com.trctc.login.ejbctrl.LoginEJBCtrl"/>

I agree. Here's the link:
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic