• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Unable to call Service method method from Managed Bean in JSF 2.2

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am New to JSF 2.2 .I want to do sample Login application using JSF2.2+Spring+Hibernate

BUt i am unable to call Service Layer from Managed Bean Class.Program Halts hear
"In Managed Bean Method line.Not calling Service Method.Please Assist



package com.demo.managedbeans;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.RequestScoped;

import com.demo.model.LoginDTO;
import com.demo.serviceimpl.LoginService;

@ManagedBean(name = "login")
@RequestScoped
public class Login {

public Login()
{
System.out.println("In Login Constructor");
}
private String passWord;
private String userName;
@ManagedProperty(value="#{service}")
private LoginService loginservice;

public LoginService getLoginservice() {
return loginservice;
}

public void setLoginservice(LoginService loginservice) {
this.loginservice = loginservice;
System.out.println("In Login Service Setter Method");
}

public String getPassWord() {
return passWord;
}

public void setPassWord(String passWord) {
this.passWord = passWord;
}

public String getUserName() {
return userName;
}

public void setUserName(String userName) {
this.userName = userName;
}
public void validate()
{
LoginDTO loginDTO=new LoginDTO();
loginDTO.setUserName(this.getUserName());
loginDTO.setPassWord(this.getPassWord());
System.out.println("In Managed Bean Method");
getLoginservice().userValidation(loginDTO);

}
}


My Service Layer
-----------------------
package com.demo.serviceimpl;

import org.springframework.transaction.annotation.Transactional;

import com.demo.dataaccessimpl.LoginDataAccess;
import com.demo.model.LoginDTO;
@Transactional(readOnly = true)
public class LoginService {

LoginDataAccess logindataAccess;

public LoginDataAccess getLogindataAccess() {
return logindataAccess;
}

public void setLogindataAccess(LoginDataAccess logindataAccess) {
this.logindataAccess = logindataAccess;
}

public LoginService()
{
System.out.println("Login Service Constructor");

}

public void userValidation(LoginDTO l)
{
System.out.println("in User Validation Method");
logindataAccess.userLoginValidation(l);
}
}
 
Ranch Hand
Posts: 499
Spring AngularJS Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
deepu bhadriraju,
If you are giving us code, Please use Code Tags.

deepu bhadriraju wrote:BUt i am unable to call Service Layer from Managed Bean Class.Program Halts hear
"In Managed Bean Method line.Not calling Service Method.Please Assist



This wont work. You will have to Tell us the Details
What happens after the program halts. Does it throw some kind of exception. If so provide us the stacktrace.


 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic