[jboss-user] [JBoss Seam] - Re: Facelets: Parameters to custom tags
niesar
do-not-reply at jboss.com
Wed Jul 19 09:39:48 EDT 2006
Hi Marcus,
I'm not sure if I correctly understand what you try to do. But let's give it a try...
In<le:kontoname konto="#{kontozeile_iter}" liste="#{leistungsschein.kontozeilen}" />you are actually passing kind of a reference of your data (kontoname_iter) to your custom tag. In kontoname.xhtml you are then accessing "kontozeile_iter" using the name "konto".
If you also want to use "konto" aka "kontoname_iter" in the bean, you need to make "kontozeile_iter" available for the bean, too.
It's hard to guess where "kontozeile_iter" is coming from in your code, but looking at the name it sounds like you are iterating through a list of - let's say - "Kontozeile" instances. I further guess a variable like "Kontozeile kontoname_iter" is supposed to be the currently selected element of the list.
If that is the case, you may want to take a look at Seam's @DataModel/@DataModelSelection. It is used in the hotel booking example, see
http://docs.jboss.com/seam/latest/reference/en/html/tutorial.html#booking . If you take a look at HotelSearchAction.java, you will find @DataModel and @DataModelSelection.
In main.xhtml (you will find it in the booking example which comes with Seam) you can see how this is used to display a list of hotels.
Now, if you want to pass your user's selection to another Bean, you can access it from there by using a getter method.
In the booking example Bean HotelSearchingAction is annotated with @Name("hotelSearch"): @Name("hotelSearch") // !!!
| @Scope(ScopeType.SESSION)
| public class HotelSearchingAction implements HotelSearching {
| ...
| @DataModel
| private List<Hotel> hotels;
| @DataModelSelection
| private Hotel selectedHotel;
| ...
| public Hotel getSelectedHotel() { // that's the way to access the user selection
| return selectedHotel;
| }
|
If you want to access the user selection from another Bean, this could be done like this:
| @In
| private HotelSearching hotelSearch // from the @Name annotation in HotelSearchingAction.java
| [...]
| // later in your code:
| Hotel selectedHotelFromOtherBean = hotelSearch.getSelectedHotel()/;
| // now do something useful with selectedHotelFromOtherBean
|
Is this more or less what you try to do?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3959136#3959136
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3959136
More information about the jboss-user
mailing list