[jboss-user] [JBoss Seam] - Re: Component Binding don't work in Seam?

g00se24 do-not-reply at jboss.com
Mon May 21 04:27:31 EDT 2007


Hello.

It's works fine for me, but the documentation is a little bit strange in that.
You can inject a Component into your bean.

package de.psi.support.gui;

import java.util.List;

import javax.ejb.Remove;
import javax.faces.component.html.HtmlDataTable;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.jboss.seam.annotations.Destroy;
import org.jboss.seam.annotations.In;

public abstract class Selection {

	@PersistenceContext
	protected EntityManager em;
		
	private Object selected;
	
	@In("#{uiComponent['form:table']}")
	protected HtmlDataTable table;

	public String getSearch() {
		return search;
	}

	public void setSearch(String search) {
		this.search = search;
	}

	protected List getResult() {
		List query = em.createQuery(getQuery()).getResultList();
		return query;
	}

	public Object getSelected() {
		return selected;
	}
	
	public void setSelected(Object selected) {
		this.selected = selected;
	}

	public void select() {
		setSelected(table.getRowData());
	}

It's a snippet of some of my classes (it's used only for inheritance -> abstract, try not to wonder about that.).

@In("#{uiComponent['form:table']}")
protected HtmlDataTable table;

That's your solution, keep in mind that the 'form:table' is the path (id!) to the component. The ":" splits the id's and not "." like it is mentioned in the seam documentation.

Good luck!

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

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



More information about the jboss-user mailing list