You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by an...@magnasteyr.com on 2005/10/24 12:07:07 UTC

Problems with setting Variable in Bean

I have problems setting values in a backing bean.

In my JSF Page a method is called through an action attribute. This method calls another method from another bean.
In this second method some variables for the JSF Page are set. The Problem now is, that the new JSF Page doesn't display these variables and I get an error stack.

Could it be, that the new Object which I create is another object than the JSF page has... How can I do that, that it works?
I hope this isn't too confusing.. Here is the code.

This is the method of the first bean(newPartner), which is called by the action attribute of the first JSF Page:

public String listforeditContact() {
String returnstring = "";
QueryHelper qh = new QueryHelper();   ---> HERE I'm making a new Object of the second bean!!! The methods of the object qh fill some SelectItem[] Variables...
	try {
		if (contacttypeArt.equalsIgnoreCase("gateway")) {
			logger.info("Contacttypeart: GATEWAY");
			qh.listContactTypes(0);
			returnstring = "popupContactGA";
		}
		if (contacttypeArt.equalsIgnoreCase("datenart")) {
			logger.info("Contacttypeart: DATENART");
			qh.listContactTypes(1);
			returnstring = "popupContactDA";
		}
		qh.listPhonePrefix();
		qh.listFaxPrefix();
		qh.listGeschlecht();

	}
	catch (Exception e1) {
		e1.printStackTrace();
	}

One of the methods of the second bean(QueryHelper) look like this:

             public void listGeschlecht() throws Exception {

		Session session = HibernateUtil.currentSession();
		Transaction tx = null;
		try {
			tx = session.beginTransaction();
			Query q = session.createQuery("from EtGendertype et");
			querylist = q.list();

			geschlecht = new SelectItem[querylist.size()];

			int i = 0;
			for (Iterator it = querylist.iterator(); it.hasNext();) {
				EtGendertype gender = (EtGendertype) it.next();
				geschlecht[i] = new SelectItem(gender.getgId(), gender
						.getGender());
				i++;
			}

			tx.commit();

		}
		catch (Exception ex) {
			if (tx != null)
				tx.rollback();
			msg = bundle.getString("selectboxGeschlecht");
			context.addMessage(null, new FacesMessage(
					FacesMessage.SEVERITY_WARN, msg, null));
			throw ex;

		}
		finally {
			HibernateUtil.closeSession();
		}

	}


On the second JSF Page I have the following: (JUST one snippet)

<td><h:selectOneMenu id="geschlecht" styleClass="mustfield"
	value="#{newPartnerDto.geschlechtId}" required="true">
			<f:selectItems value="#{queryHelper.geschlecht}" />  -->HERE I'm trying to get the SELECTITEM VARIABLE OF THE BEAN QUERYHELPER!!!
</h:selectOneMenu></td>

Thx!

Regards
Andy

______________________________________________________________________

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
your system manager.
 
This footnote also confirms that this email message has been swept
for the presence of computer viruses. 
______________________________________________________________________

Re: Problems with setting Variable in Bean

Posted by Werner Punz <we...@gmx.at>.
Sorry I forgot the link:
http://www.javaworld.com/javaworld/jw-07-2004/jw-0719-jsf.html

and the code is
http://www.javaworld.com/javaworld/jw-07-2004/jsf/jw-0719-jsf.zip

with the FacesUtils class under:
src/java/catalog/view/util

If you have licensing problems (the code is under no license)
I have a mail of Derk Shen himself which basically gave
me permission to get that class under Apache 2.0, so send me a private
mail if you need an Apache 2.0 licensed version of that class, I will
send you the code and the confirm mail this evening.

(Dunno what to do with it now, since I do not know if MyFaces is in need
of that class, it would introduce a central dependency into one single
class, which might not be feasable)


Werner


Werner Punz wrote:
> QueryHelper qh = new QueryHelper();   ---> HERE I'm making a new Object
> of the second bean!!! The methods of the object qh fill some
> SelectItem[] Variables...
> 
> this is your problem, you should use the jsf variable resolver mechanism
> to take care of the backend bean generation.
> 
> I can recommend to use the excellent JsfUtil class you can find
> on www.javaworld.com and in appfuse, which encapsules all the
> mechanisms. This class has a getManagedBean method which takes care
> of all that.
> 
> 
> 
> Werner
> 
> 
> 
> andreas.mitter@magnasteyr.com wrote:
> 
>>I have problems setting values in a backing bean.
>>
>>In my JSF Page a method is called through an action attribute. This
>>method calls* another* method from* another bean*.
>>In this second method some variables for the JSF Page are set. The
>>Problem now is, that the new JSF Page doesn't display these variables
>>and I get an error stack.
>>
>>Could it be, that the new Object which I create is another object than
>>the JSF page has... How can I do that, that it works?
>>
>>I hope this isn't too confusing.. Here is the code.
>>
>>*This is the method of the first bean(newPartner), which is called by
>>the action attribute of the first JSF Page:*
>>
>>/public String listforeditContact() {/
>>/String returnstring = "";/
>>/QueryHelper qh = new QueryHelper();   --->__//_* HERE I'm making a new
>>Object of the second bean!!! The methods of the object qh fill some
>>SelectItem[] Variables...*_**/
>>
>>/        try {/
>>/                if (contacttypeArt.equalsIgnoreCase("gateway")) {/
>>/                        logger.info("Contacttypeart: GATEWAY");/
>>/                        qh.listContactTypes(0);/
>>/                        returnstring = "popupContactGA";/
>>/                }/
>>/                if (contacttypeArt.equalsIgnoreCase("datenart")) {/
>>/                        logger.info("Contacttypeart: DATENART");/
>>/                        qh.listContactTypes(1);/
>>/                        returnstring = "popupContactDA";/
>>/                }/
>>/                qh.listPhonePrefix();/
>>/                qh.listFaxPrefix();/
>>/                qh.listGeschlecht();/
>>
>>/        }/
>>/        catch (Exception e1) {/
>>/                e1.printStackTrace();/
>>/        }/
>>
>>*One of the methods of the second bean(QueryHelper) look like this:*
>>
>>       /      public void listGeschlecht() throws Exception {/
>>
>>/                Session session = HibernateUtil.currentSession();/
>>/                Transaction tx = null;/
>>/                try {/
>>/                        tx = session.beginTransaction();/
>>/                        Query q = session.createQuery("from
>>EtGendertype et");/
>>/                        querylist = q.list();/
>>
>>/                        geschlecht = new SelectItem[querylist.size()];/
>>
>>/                        int i = 0;/
>>/                        for (Iterator it = querylist.iterator();
>>it.hasNext();) {/
>>/                                EtGendertype gender = (EtGendertype)
>>it.next();/
>>/                                geschlecht[i] = new
>>SelectItem(gender.getgId(), gender/
>>/                                                .getGender());/
>>/                                i++;/
>>/                        }/
>>
>>/                        tx.commit();/
>>
>>/                }/
>>/                catch (Exception ex) {/
>>/                        if (tx != null)/
>>/                                tx.rollback();/
>>/                        msg = bundle.getString("selectboxGeschlecht");/
>>/                        context.addMessage(null, new FacesMessage(/
>>/                                        FacesMessage.SEVERITY_WARN,
>>msg, null));/
>>/                        throw ex;/
>>
>>/                }/
>>/                finally {/
>>/                        HibernateUtil.closeSession();/
>>/                }/
>>
>>/        }/
>>
>>
>>*On the second JSF Page I have the following: (JUST one snippet)*
>>
>><td><h:selectOneMenu id="geschlecht" styleClass="mustfield"
>>        value="#{newPartnerDto.geschlechtId}" required="true">
>>                        <f:selectItems value="#{queryHelper.geschlecht}"
>>/>  -->HERE I'm trying to get the SELECTITEM VARIABLE OF THE BEAN
>>QUERYHELPER!!!
>>
>></h:selectOneMenu></td>
>>
>>Thx!
>>
>>Regards
>>Andy
>>
>>
>>______________________________________________________________________
>>This email and any files transmitted with it are confidential and
>>intended solely for the use of the individual or entity to whom they are
>>addressed. If you have received this email in error please notify your
>>system manager. This footnote also confirms that this email message has
>>been swept for the presence of computer viruses.
>>______________________________________________________________________
> 
> 
> 


Re: Problems with setting Variable in Bean

Posted by Werner Punz <we...@gmx.at>.
Well, it might be the wrong way in the long run,
but for now it is a viable approach for an application.
I do not think that there should be just one way to
fetch a bean (which would be IoC)

Face it getting a managed bean is rough for a newby, with all the faces context
variable resolver stuff.

Having some kind of factory where you simply can fetch a managed bean once you need it is a
viable approach.

But going IoC only easily can become a maintenance nightmare as well, lets keep
things open and do not lock users into one pure approach.

I also like IoC and the elegance in which Seam does this is really convincing,
but I would never tell users to use IoC only because in my opinion each approach
has its merits and downsides.
IoC in xml config files can become a huge nightmare once you have more than a handful
of interwoven beans.
But it is awesome if you have to deal with Mockup objects which you then have to replace on the
fly with real implementations or AOP.

So finding a good middle way probably is the way to go for now ;-)

I do not thing that going IoC only is a really good approach as long
as you have to keep the entire data in xml graves, once you can apply this stuff
via annotations like Seam does it, it might be the best way to go (if you do not
get locked out of central config files)
But in the end this is a philosophical discussion and nothing more ;-), and everone
should use whatever is best to achieve the results ;-)




Simon Kitching wrote:
> Werner Punz wrote:
> 
>> QueryHelper qh = new QueryHelper();   ---> HERE I'm making a new Object
>> of the second bean!!! The methods of the object qh fill some
>> SelectItem[] Variables...
>>
>> this is your problem, you should use the jsf variable resolver mechanism
>> to take care of the backend bean generation.
>>
>> I can recommend to use the excellent JsfUtil class you can find
>> on www.javaworld.com and in appfuse, which encapsules all the
>> mechanisms. This class has a getManagedBean method which takes care
>> of all that.
> 
> 
> I think the "getManagedBean" method is looking at the problem the wrong
> way. The server world is definitely moving towards "dependency
> injection" as a replacement for "dependency lookup". Examples are
> Spring, HiveMind, EJB3.
> 
> JSF supports "dependency injection" in the managed bean declarations:
> 
> 
> <managed-bean>
>   <managed-bean-name>queryHelper</managed-bean-name>
>   <managed-bean-class>example.QueryHelper</managed-bean-class>
>   <managed-bean-scope>session</managed-bean-scope>
> </managed-bean>
> 
> <managed-bean>
>   <managed-bean-name>foo</managed-bean-name>
>   <managed-bean-class>example.Foo</managed-bean-class>
>   <managed-bean-scope>session</managed-bean-scope>
>   <!--  use dependency injection to pass queryHelper -->
>   <managed-property>           
>      <property-name>queryHelper</property-name>
>      <value>#{queryHelper}</value>
>   </managed-property>           
> </managed-bean>
> 
> This will cause Foo.setQueryHelper(obj) to be called when a "managed
> bean" instance of Foo is created, passing the queryHelper managed bean
> instance as a parameter.
> 
> No need to "look up" the bean at all; it gets effectively passed as an
> "initialisation value" to the Foo object.
> 
> 
> NB: the lookup implemented by the JsfUtils lib will work, and there's
> nothing wrong with it. It just seems a little "old fashioned" now.
> 
> NB2: Someone did report difficulties getting this approach working with
> JSF on Spring.
> 
> Regards,
> 
> Simon
> 


Re: Problems with setting Variable in Bean

Posted by Simon Kitching <sk...@obsidium.com>.
Werner Punz wrote:
> QueryHelper qh = new QueryHelper();   ---> HERE I'm making a new Object
> of the second bean!!! The methods of the object qh fill some
> SelectItem[] Variables...
> 
> this is your problem, you should use the jsf variable resolver mechanism
> to take care of the backend bean generation.
> 
> I can recommend to use the excellent JsfUtil class you can find
> on www.javaworld.com and in appfuse, which encapsules all the
> mechanisms. This class has a getManagedBean method which takes care
> of all that.

I think the "getManagedBean" method is looking at the problem the wrong 
way. The server world is definitely moving towards "dependency 
injection" as a replacement for "dependency lookup". Examples are 
Spring, HiveMind, EJB3.

JSF supports "dependency injection" in the managed bean declarations:


<managed-bean>
   <managed-bean-name>queryHelper</managed-bean-name>
   <managed-bean-class>example.QueryHelper</managed-bean-class>
   <managed-bean-scope>session</managed-bean-scope>
</managed-bean>

<managed-bean>
   <managed-bean-name>foo</managed-bean-name>
   <managed-bean-class>example.Foo</managed-bean-class>
   <managed-bean-scope>session</managed-bean-scope>
   <!--  use dependency injection to pass queryHelper -->
   <managed-property>			
      <property-name>queryHelper</property-name>
      <value>#{queryHelper}</value>
   </managed-property>			
</managed-bean>

This will cause Foo.setQueryHelper(obj) to be called when a "managed 
bean" instance of Foo is created, passing the queryHelper managed bean 
instance as a parameter.

No need to "look up" the bean at all; it gets effectively passed as an 
"initialisation value" to the Foo object.


NB: the lookup implemented by the JsfUtils lib will work, and there's 
nothing wrong with it. It just seems a little "old fashioned" now.

NB2: Someone did report difficulties getting this approach working with 
JSF on Spring.

Regards,

Simon

Re: AW: Problems with setting Variable in Bean

Posted by Werner Punz <we...@gmx.at>.
http://www.javaworld.com/javaworld/jw-07-2004/jw-0719-jsf.html

and the code is
http://www.javaworld.com/javaworld/jw-07-2004/jsf/jw-0719-jsf.zip

with the FacesUtils class under:
src/java/catalog/view/util



Hans Sowa wrote:
> HI
> 
> I would like to have a look at the JsfUtil class but I can't find it. Please
> could explain it in more detail where we can find it.
>  
> Thanks a lot.
> 
> mfg Hans Sowa
> PROCON DATA Datenverarbeitung Ges.m.b.H.
> mailto:hans.sowa@procon.co.at
> http://www.procon.co.at
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: news [mailto:news@sea.gmane.org] Im Auftrag von Werner Punz
> Gesendet: Montag, 24. Oktober 2005 12:57
> An: users@myfaces.apache.org
> Betreff: Re: Problems with setting Variable in Bean
> 
> QueryHelper qh = new QueryHelper();   ---> HERE I'm making a new Object
> of the second bean!!! The methods of the object qh fill some
> SelectItem[] Variables...
> 
> this is your problem, you should use the jsf variable resolver mechanism
> to take care of the backend bean generation.
> 
> I can recommend to use the excellent JsfUtil class you can find
> on www.javaworld.com and in appfuse, which encapsules all the
> mechanisms. This class has a getManagedBean method which takes care
> of all that.
> 
> 
> 
> Werner
> 
> 
> 
> andreas.mitter@magnasteyr.com wrote:
> 
>>I have problems setting values in a backing bean.
>>
>>In my JSF Page a method is called through an action attribute. This
>>method calls* another* method from* another bean*.
>>In this second method some variables for the JSF Page are set. The
>>Problem now is, that the new JSF Page doesn't display these variables
>>and I get an error stack.
>>
>>Could it be, that the new Object which I create is another object than
>>the JSF page has... How can I do that, that it works?
>>
>>I hope this isn't too confusing.. Here is the code.
>>
>>*This is the method of the first bean(newPartner), which is called by
>>the action attribute of the first JSF Page:*
>>
>>/public String listforeditContact() {/
>>/String returnstring = "";/
>>/QueryHelper qh = new QueryHelper();   --->__//_* HERE I'm making a new
>>Object of the second bean!!! The methods of the object qh fill some
>>SelectItem[] Variables...*_**/
>>
>>/        try {/
>>/                if (contacttypeArt.equalsIgnoreCase("gateway")) {/
>>/                        logger.info("Contacttypeart: GATEWAY");/
>>/                        qh.listContactTypes(0);/
>>/                        returnstring = "popupContactGA";/
>>/                }/
>>/                if (contacttypeArt.equalsIgnoreCase("datenart")) {/
>>/                        logger.info("Contacttypeart: DATENART");/
>>/                        qh.listContactTypes(1);/
>>/                        returnstring = "popupContactDA";/
>>/                }/
>>/                qh.listPhonePrefix();/
>>/                qh.listFaxPrefix();/
>>/                qh.listGeschlecht();/
>>
>>/        }/
>>/        catch (Exception e1) {/
>>/                e1.printStackTrace();/
>>/        }/
>>
>>*One of the methods of the second bean(QueryHelper) look like this:*
>>
>>       /      public void listGeschlecht() throws Exception {/
>>
>>/                Session session = HibernateUtil.currentSession();/
>>/                Transaction tx = null;/
>>/                try {/
>>/                        tx = session.beginTransaction();/
>>/                        Query q = session.createQuery("from
>>EtGendertype et");/
>>/                        querylist = q.list();/
>>
>>/                        geschlecht = new SelectItem[querylist.size()];/
>>
>>/                        int i = 0;/
>>/                        for (Iterator it = querylist.iterator();
>>it.hasNext();) {/
>>/                                EtGendertype gender = (EtGendertype)
>>it.next();/
>>/                                geschlecht[i] = new
>>SelectItem(gender.getgId(), gender/
>>/                                                .getGender());/
>>/                                i++;/
>>/                        }/
>>
>>/                        tx.commit();/
>>
>>/                }/
>>/                catch (Exception ex) {/
>>/                        if (tx != null)/
>>/                                tx.rollback();/
>>/                        msg = bundle.getString("selectboxGeschlecht");/
>>/                        context.addMessage(null, new FacesMessage(/
>>/                                        FacesMessage.SEVERITY_WARN,
>>msg, null));/
>>/                        throw ex;/
>>
>>/                }/
>>/                finally {/
>>/                        HibernateUtil.closeSession();/
>>/                }/
>>
>>/        }/
>>
>>
>>*On the second JSF Page I have the following: (JUST one snippet)*
>>
>><td><h:selectOneMenu id="geschlecht" styleClass="mustfield"
>>        value="#{newPartnerDto.geschlechtId}" required="true">
>>                        <f:selectItems value="#{queryHelper.geschlecht}"
>>/>  -->HERE I'm trying to get the SELECTITEM VARIABLE OF THE BEAN
>>QUERYHELPER!!!
>>
>></h:selectOneMenu></td>
>>
>>Thx!
>>
>>Regards
>>Andy
>>
>>
>>______________________________________________________________________
>>This email and any files transmitted with it are confidential and
>>intended solely for the use of the individual or entity to whom they are
>>addressed. If you have received this email in error please notify your
>>system manager. This footnote also confirms that this email message has
>>been swept for the presence of computer viruses.
>>______________________________________________________________________
> 
> 
> 
> 


AW: Problems with setting Variable in Bean

Posted by Hans Sowa <ha...@procon.co.at>.
HI

I would like to have a look at the JsfUtil class but I can't find it. Please
could explain it in more detail where we can find it.
 
Thanks a lot.

mfg Hans Sowa
PROCON DATA Datenverarbeitung Ges.m.b.H.
mailto:hans.sowa@procon.co.at
http://www.procon.co.at


-----Ursprüngliche Nachricht-----
Von: news [mailto:news@sea.gmane.org] Im Auftrag von Werner Punz
Gesendet: Montag, 24. Oktober 2005 12:57
An: users@myfaces.apache.org
Betreff: Re: Problems with setting Variable in Bean

QueryHelper qh = new QueryHelper();   ---> HERE I'm making a new Object
of the second bean!!! The methods of the object qh fill some
SelectItem[] Variables...

this is your problem, you should use the jsf variable resolver mechanism
to take care of the backend bean generation.

I can recommend to use the excellent JsfUtil class you can find
on www.javaworld.com and in appfuse, which encapsules all the
mechanisms. This class has a getManagedBean method which takes care
of all that.



Werner



andreas.mitter@magnasteyr.com wrote:
> I have problems setting values in a backing bean.
> 
> In my JSF Page a method is called through an action attribute. This
> method calls* another* method from* another bean*.
> In this second method some variables for the JSF Page are set. The
> Problem now is, that the new JSF Page doesn't display these variables
> and I get an error stack.
> 
> Could it be, that the new Object which I create is another object than
> the JSF page has... How can I do that, that it works?
> 
> I hope this isn't too confusing.. Here is the code.
> 
> *This is the method of the first bean(newPartner), which is called by
> the action attribute of the first JSF Page:*
> 
> /public String listforeditContact() {/
> /String returnstring = "";/
> /QueryHelper qh = new QueryHelper();   --->__//_* HERE I'm making a new
> Object of the second bean!!! The methods of the object qh fill some
> SelectItem[] Variables...*_**/
> 
> /        try {/
> /                if (contacttypeArt.equalsIgnoreCase("gateway")) {/
> /                        logger.info("Contacttypeart: GATEWAY");/
> /                        qh.listContactTypes(0);/
> /                        returnstring = "popupContactGA";/
> /                }/
> /                if (contacttypeArt.equalsIgnoreCase("datenart")) {/
> /                        logger.info("Contacttypeart: DATENART");/
> /                        qh.listContactTypes(1);/
> /                        returnstring = "popupContactDA";/
> /                }/
> /                qh.listPhonePrefix();/
> /                qh.listFaxPrefix();/
> /                qh.listGeschlecht();/
> 
> /        }/
> /        catch (Exception e1) {/
> /                e1.printStackTrace();/
> /        }/
> 
> *One of the methods of the second bean(QueryHelper) look like this:*
> 
>        /      public void listGeschlecht() throws Exception {/
> 
> /                Session session = HibernateUtil.currentSession();/
> /                Transaction tx = null;/
> /                try {/
> /                        tx = session.beginTransaction();/
> /                        Query q = session.createQuery("from
> EtGendertype et");/
> /                        querylist = q.list();/
> 
> /                        geschlecht = new SelectItem[querylist.size()];/
> 
> /                        int i = 0;/
> /                        for (Iterator it = querylist.iterator();
> it.hasNext();) {/
> /                                EtGendertype gender = (EtGendertype)
> it.next();/
> /                                geschlecht[i] = new
> SelectItem(gender.getgId(), gender/
> /                                                .getGender());/
> /                                i++;/
> /                        }/
> 
> /                        tx.commit();/
> 
> /                }/
> /                catch (Exception ex) {/
> /                        if (tx != null)/
> /                                tx.rollback();/
> /                        msg = bundle.getString("selectboxGeschlecht");/
> /                        context.addMessage(null, new FacesMessage(/
> /                                        FacesMessage.SEVERITY_WARN,
> msg, null));/
> /                        throw ex;/
> 
> /                }/
> /                finally {/
> /                        HibernateUtil.closeSession();/
> /                }/
> 
> /        }/
> 
> 
> *On the second JSF Page I have the following: (JUST one snippet)*
> 
> <td><h:selectOneMenu id="geschlecht" styleClass="mustfield"
>         value="#{newPartnerDto.geschlechtId}" required="true">
>                         <f:selectItems value="#{queryHelper.geschlecht}"
> />  -->HERE I'm trying to get the SELECTITEM VARIABLE OF THE BEAN
> QUERYHELPER!!!
> 
> </h:selectOneMenu></td>
> 
> Thx!
> 
> Regards
> Andy
> 
> 
> ______________________________________________________________________
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they are
> addressed. If you have received this email in error please notify your
> system manager. This footnote also confirms that this email message has
> been swept for the presence of computer viruses.
> ______________________________________________________________________



Re: Problems with setting Variable in Bean

Posted by Werner Punz <we...@gmx.at>.
QueryHelper qh = new QueryHelper();   ---> HERE I'm making a new Object
of the second bean!!! The methods of the object qh fill some
SelectItem[] Variables...

this is your problem, you should use the jsf variable resolver mechanism
to take care of the backend bean generation.

I can recommend to use the excellent JsfUtil class you can find
on www.javaworld.com and in appfuse, which encapsules all the
mechanisms. This class has a getManagedBean method which takes care
of all that.



Werner



andreas.mitter@magnasteyr.com wrote:
> I have problems setting values in a backing bean.
> 
> In my JSF Page a method is called through an action attribute. This
> method calls* another* method from* another bean*.
> In this second method some variables for the JSF Page are set. The
> Problem now is, that the new JSF Page doesn't display these variables
> and I get an error stack.
> 
> Could it be, that the new Object which I create is another object than
> the JSF page has... How can I do that, that it works?
> 
> I hope this isn't too confusing.. Here is the code.
> 
> *This is the method of the first bean(newPartner), which is called by
> the action attribute of the first JSF Page:*
> 
> /public String listforeditContact() {/
> /String returnstring = "";/
> /QueryHelper qh = new QueryHelper();   --->__//_* HERE I'm making a new
> Object of the second bean!!! The methods of the object qh fill some
> SelectItem[] Variables...*_**/
> 
> /        try {/
> /                if (contacttypeArt.equalsIgnoreCase("gateway")) {/
> /                        logger.info("Contacttypeart: GATEWAY");/
> /                        qh.listContactTypes(0);/
> /                        returnstring = "popupContactGA";/
> /                }/
> /                if (contacttypeArt.equalsIgnoreCase("datenart")) {/
> /                        logger.info("Contacttypeart: DATENART");/
> /                        qh.listContactTypes(1);/
> /                        returnstring = "popupContactDA";/
> /                }/
> /                qh.listPhonePrefix();/
> /                qh.listFaxPrefix();/
> /                qh.listGeschlecht();/
> 
> /        }/
> /        catch (Exception e1) {/
> /                e1.printStackTrace();/
> /        }/
> 
> *One of the methods of the second bean(QueryHelper) look like this:*
> 
>        /      public void listGeschlecht() throws Exception {/
> 
> /                Session session = HibernateUtil.currentSession();/
> /                Transaction tx = null;/
> /                try {/
> /                        tx = session.beginTransaction();/
> /                        Query q = session.createQuery("from
> EtGendertype et");/
> /                        querylist = q.list();/
> 
> /                        geschlecht = new SelectItem[querylist.size()];/
> 
> /                        int i = 0;/
> /                        for (Iterator it = querylist.iterator();
> it.hasNext();) {/
> /                                EtGendertype gender = (EtGendertype)
> it.next();/
> /                                geschlecht[i] = new
> SelectItem(gender.getgId(), gender/
> /                                                .getGender());/
> /                                i++;/
> /                        }/
> 
> /                        tx.commit();/
> 
> /                }/
> /                catch (Exception ex) {/
> /                        if (tx != null)/
> /                                tx.rollback();/
> /                        msg = bundle.getString("selectboxGeschlecht");/
> /                        context.addMessage(null, new FacesMessage(/
> /                                        FacesMessage.SEVERITY_WARN,
> msg, null));/
> /                        throw ex;/
> 
> /                }/
> /                finally {/
> /                        HibernateUtil.closeSession();/
> /                }/
> 
> /        }/
> 
> 
> *On the second JSF Page I have the following: (JUST one snippet)*
> 
> <td><h:selectOneMenu id="geschlecht" styleClass="mustfield"
>         value="#{newPartnerDto.geschlechtId}" required="true">
>                         <f:selectItems value="#{queryHelper.geschlecht}"
> />  -->HERE I'm trying to get the SELECTITEM VARIABLE OF THE BEAN
> QUERYHELPER!!!
> 
> </h:selectOneMenu></td>
> 
> Thx!
> 
> Regards
> Andy
> 
> 
> ______________________________________________________________________
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they are
> addressed. If you have received this email in error please notify your
> system manager. This footnote also confirms that this email message has
> been swept for the presence of computer viruses.
> ______________________________________________________________________