JSF navigation and passing parameters -


i'm having problems jsf navigation , passing parameters; scenario:

three pages: artists, albums, tracks

for each page bean: artistbean, albumbean, trackbean (session scoped)

the artist page contains list of artists, each artistname link , when clicking navigate album page lists albums artist. similarly, when clicking album, navigate track page list of tracks album.

the links looks follows:

page artist: <h:commandlink action="#{albumbean.showalbums(artist)}" value="#{artist.name}" /> page album:  <h:commandlink action="#{trackbean.showtracks(album)}" value="#{album.name}" /> 

the beans looks follows:

albumbean: public string showalbums(artist artist){               [generate list of albums, fetched page "albums" using getalbumlist()]               return "albums";            }             public list<album> getalbumlist(){               return albumlist;            }  trackbean: public string showtracks(album album){               [generate list of tracks, fetched page "tracks" using gettracklist()]               return "tracks";            }             public list<track> gettracklist(){               return tracklist;            } 

i'm not sure if "ok" way handle navigation; calling backing bean page has not yet bean displayed. weird behaviour, links show tracks works if click twice, whereas links show albums work when clicking once.

thanks in advance!

i'm not sure if wrong doing. find complicated. more straightforward solutions seems me following:

you have 3 beans , 3 pages. artist bean called in artist page , on.

navigating between pages done via links , add parameter. on album bean, read passed parameter , fill list of albums on basis of parameter (you use name or id key value)

same goes track info.

that way don't need have beans on session scope. better use view scope.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -