You have more than a way to go.. but you should at first, create a navigation rule for page1.faces in your faces-config.xml:
<navigation-rule>
<from-view-id>/page2.jsp</from-view-id>
<navigation-case>
<from-outcome>gotoPage1</from-outcome>
<to-view-id>/page1.jsp</to-view-id>
</navigation-case>
</navigation-rule>
1) With a field
If you have a field in your page2.faces binded to #{controller.name }, things are very simple. Simply put a
<h:commandLink value="Goto page 1" action="" />
in page2.jsp. You fill find the property already updated to the field value after you got forwarded to page1.faces.
2) Without a field, and without using a controller method
If you want to "manually" set the property value from the jsp page, without a field, you can do like this in your page2.faces :
<h:commandLink value="Goto page 1" action=""> <t:updateActionListener property="#{controller.name}" value="Chrisi" />
</h:commandLink>
The t:updateActionListener tomahawk component will update the controller property to the specified value before bringing you to page1.faces.
3) Using a controller method
Lastly, you can also create a method in your controller bean to perform the job:
public void updateAndGo() {
setName("Chrisi");
return "gotoPage1";
}
This could be good if you need more complex processing. To invoke it, you have to put in your page2.faces something like:
<h:commandLink action="" />
Hope this help
Cosma
On 5/10/06,
Chrisi <[EMAIL PROTECTED]> wrote:
Hello,this is a beginner question:I have two java server faces pages.Nr.1 'page1.faces': Contains just a simple form with an input-field like the following<h:inputText value="#{controller.name}"/Nr.2 'page2.faces': Should contain a simple link to 'page1.faces'. When clicking onthe link, a value like 'Chrisi' should be transfert to the text-field and page1.faces shouldbe rendered.What is the JSF way to do this right?Sure, I can do something like this <a href="" andlet the page1.faces check the parameter 'name' using EL.But there should be a better way using the JSF lifecycle and the controller/modell concept, right?
--
Thanks and Greetings
Chrisi

