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
> 
> 
> 
> [EMAIL PROTECTED] 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.
>>______________________________________________________________________
> 
> 
> 

Reply via email to