[jboss-user] [JBoss Seam] - Facelets: Parameters to custom tags

MSchmidke do-not-reply at jboss.com
Wed Jul 19 05:09:36 EDT 2006


Hello,

I am using MyFaces / Facelets / Seam. 

Can I inject the attributes of a custom tag into my bean?

I've written a custom tag with tag file:


  | <tag>
  | 	<tag-name>kontoname</tag-name>
  | 	<source>kontoname.xhtml</source>
  | </tag>
  | 

kontoname.xhtml:

  | <ui:component xmlns:ui="http://java.sun.com/jsf/facelets"
  | 	xmlns:h="http://java.sun.com/jsf/html"
  |     xmlns:f="http://java.sun.com/jsf/core"
  |     xmlns:t="http://myfaces.apache.org/tomahawk"
  | 	>
  | 		
  | 	<ui:repeat value="#{liste.angezeigteSpalten}" var="spalte">
  | 		<td class="auftragszelle">
  | 			<h:outputText value="#{kontoname.wert}" />
  | 		</td>
  | 	</ui:repeat>
  | 	<td class="auftragszelle">
  | 		?
  | 	</td>
  | </ui:component>
  | 

I'm calling this tag with arguments:

  | <le:kontoname konto="#{kontozeile_iter}" liste="#{leistungsschein.kontozeilen}" />
  | 

The Tag is using a Java bean:

  | @SuppressWarnings("serial")
  | @Scope(ScopeType.APPLICATION)
  | @Name("kontoname")
  | public class Kontoname implements Serializable{
  | 
  |   private @In(required=false) Kontowrapper konto;
  |   private @In(required=false) Anzeigespalte spalte;
  |   
  |   public String getWert() {
  |     if (spalte==null) return "Keine Spalte angegeben";
  |     if (konto==null) return "Kein Konto angegeben";
  |     return spalte.getWertInObjekt(konto);
  |   }
  |   
  | }
  | 

Unfortunately, this does not work. Accessing the "liste" argument from within the tag file is no problem, but accessing the "konto" argument from within the JavaBean isn't possible.

Can I do anything to get the parameter injected?

Thank you!!

Regards,

Marcus.

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

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



More information about the jboss-user mailing list