jsf - Pass values between Managed Beans of different pages -



jsf - Pass values between Managed Beans of different pages -

i can't pass values between 2 managed beans of different pages. implementing search box jsf component in home page. request values , when user hits search goes search result page. search result page has jsf component search resukts needs access selection in managed bean correspond search box home page.

i have tried using injection seams managed bean box reintialized, showing default value. pick involvement search box, i.e. cinema, click search takes me search result, hope see cinema see sport defualt value. please find code below.

search result managed bean

import javax.el.elcontext; import javax.faces.bean.applicationscoped; import javax.faces.bean.managedbean; import javax.faces.bean.managedproperty; import javax.faces.bean.requestscoped; import javax.faces.context.facescontext; @managedbean @applicationscoped public class expsearchresultsmb { /** creates new instance of expsearchresultsmb */ public expsearchresultsmb() { } @managedproperty(value="#{expsearchboxmb.selectedvalue}") private string selectedvalue; // +setter @managedproperty(value="#{expsearchboxmb.text}") private string prova; public string getprova() { homecoming prova; } public void setprova(string prova) { this.prova = prova; } public string getselectedvalue() { homecoming selectedvalue; } public void setselectedvalue(string selectedvalue) { this.selectedvalue = selectedvalue; } }

search box managed bean

import javax.faces.bean.managedbean; import javax.faces.bean.requestscoped; import javax.faces.bean.applicationscoped; import javax.faces.bean.managedproperty; @managedbean @applicationscoped public class expsearchboxmb { public date date; public list<string> interests=new arraylist<string>(); public string selectedvalue="sport"; public string getselectedvalue() { homecoming selectedvalue; } public void setselectedvalue(string selectedvalue) { this.selectedvalue = selectedvalue; } public list<string> getinterests() { interests.add("sport"); interests.add("musin"); interests.add("art"); interests.add("thatre"); interests.add("cinema"); homecoming interests; } public void setinterests(list<string> interests) { this.interests = interests; }

i appreciate help.

cheers

i debug , check if right value set on selection alter of interests.

if everythig right still see wrong results seek using next code in expsearchresultsmb

facescontext context = facescontext.getcurrentinstance(); expsearchboxmb expsearchboxmbbean = (expsearchboxmb) context.getapplication().evaluateexpressionget(context, "#{expsearchboxmb}", expsearchboxmb.class); expsearchboxmbbean.getselectedvalue()

jsf communication managed-bean

Comments

Popular posts from this blog

delphi - blogger via idHTTP : error 400 bad request -

c++ - cuda, pycuda -- how to write complex numbers -- errors:class "cuComplex" has no member "i" -

How do I check if an insert was successful with MySQLdb in Python? -