Hi.
I'm using MyFaces 1.1.5, Facelets 1.1.12, Java 6 and Tomcat 5.5.
1) page1.xhtml with backing bean Page1.java. Page loads properly, displays
a form of some sort.
2) User types some info into page1.xhtml and hits "Save" which calls
Page1.save().
3) Page1.save() method returns a String. JSF handles the page navigation
and redirection.
Problem: I can return "page2", to go to the second page in the flow. But I
need to initialize the backing bean for page2.xhtml which is called
Page2.java. If I simply use a faces-config.xml-defined navigation rule
("page2") I can't do this initialization... it'll call the page but won't
call any methods to initialize. So page2.xhtml displays for the user but
they don't see the effect of the data they entered on page1.xhtml.
Constraint: Ajax4jsf only seems to work when I have a no-argument empty
constructor, so I can't do backing bean initialization there.
Question: In a commandLink I can specify #{page2.myInitMethod} (Facelets
processes the EL and tells JSF where to go) which allows me to initialize my
backing bean and return String "page2" so that the user gets the page. But
I can't do that in step 3) above... the backing bean can only return a
String that's pre-defined in faces-config.xml. Is there any way to route
the browser from a backing bean to another page while specifying an
initialization method? Assuming I can't return "page2.myInitMethod".
Motivation: Slowly moving from a plain MyFaces implementation towards Seam
which requires no-argument empty constructors. Also looking to get Ajax4Jsf
running on multi-screen wizard-like flows. The app consists of about 50
backing beans and in the past I used java object constructors to initialize
the beans, load stuff from the database, etc. I'm sure I'm missing some
basic page flow design pattern built into JSF and any help is appreciated.
Thanks,
Joe