[jboss-user] [JBoss Seam] - SEAM remoting problem

alex_enache do-not-reply at jboss.com
Thu Oct 11 12:23:00 EDT 2007


Hi!

I have two classes. One is the POJO that maps on a table in my db. This is a simple class with getters and setters(the name of the class is Project). I have a ProjectManager class which I want to remotely access in javascript. I will post only the code for the ProjectManager class.

@Scope(EVENT)
  | @Name("projectManager")
  | public class ProjectManager implements GeneralManager {
  | 	
  | 	@In(required=false) @Out(required=false)
  | 	private Project project;
  | 	
  | 	@In
  | 	private UserSession userSession;
  | 	
  | 	@In
  | 	private Session hibernateSession;
  | 
  | 	@WebRemote
  | 	public List<Project> getProjects() {
  | 		List<Project> projects = hibernateSession.createQuery("from Project p").list();
  | 		return projects;
  | 	}
  | 
  | 	public String persist() {
  | 		System.out.println(project.getPrjName());
  | 		project.setUserId(userSession.getUser().getUserId());
  | 		hibernateSession.save(project);
  | 		return "dataPersisted";
  | 	}
  | 	
  | 	public String delete() {
  | 		return null;
  | 	}
  | 	
  | 	public String update() {
  | 		return null;
  | 	}
  | }

When I access the getProjects method through javascript it works great. No errors there. My problem is when I try to parse the list that is returned by the method. I just don't know how to parse that array. Any clues?

This is the js code.
function processData() {
  | 	Seam.Remoting.displayLoadingMessage = function(){};
  | 	Seam.Remoting.hideLoadingMessage = function(){};
  | 	Seam.Component.getInstance("projectManager").getProjects(projectsFoundCallback);
  | 	
  | 	function projectsFoundCallback(result) {
  | //          process results
  |     }
  | }

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4094188#4094188

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4094188



More information about the jboss-user mailing list