I have some pages that do exactly what you want.  They are for Tapestry 4.
Imports not shown.

The edit settings page displays a user setting in a textbox that was
stored in a user object.
When you save the form, it takes the value in the text box (may have
changed) and stores it back in the user object.  It then forwards you
to a page that is very similar, except it just displays the settings
you stored (no editing allowed).

In my real application the user object has a user settings object in
it.  Inside the user settings object I have lots of actual settings.
This code is based off of chapter 2 of Enjoying Web Development with
Tapestry.  That chapter is free online.

EditSettings.java
public abstract class EditSettings extends BasePage implements
                PageValidateListener {
 @InjectPage("ShowSettings")
 abstract public ShowSettings getShowSettingsPage();
 public IPage onSave(IRequestCycle cycle) {
   getUser().setSomeUserSetting(getSomeUserSetting());
   ShowSettings resultPage = getShowSettingsPage();
   return resultPage;
 }
 @InitialValue("getUser().SomeUserSetting()")
 abstract public String getSomeUserSetting();

 @InjectState("user")
 public abstract User getUser();

}


EditSettings.html
<form jwcid="EditSettingsForm">
<table><tr><td>User Setting:</td>
   <td><input type="text" jwcid="[EMAIL PROTECTED]"
value="ognl:SomeUserSetting" /></td></tr></table>
</form>

EditSettings.page
<?xml version="1.0"?>
<!DOCTYPE page-specification PUBLIC
 "-//Apache Software Foundation//Tapestry Specification 4.0//EN"
 "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd";>
<page-specification class="EditSettings">
   <component id="EditSettingsForm" type="Form">
       <binding name="listener" value="listener:onSave"/>
   </component>
</page-specification>


ShowSettings.java
public abstract class ShowSettings extends BasePage implements
                PageValidateListener {
 @InjectState("user")
 public abstract User getUser();

 @InitialValue("getUser().getSomeUserSetting()")
 abstract public String getSomeusersetting();
}

ShowSettings.html
<p>The setting is: <span [EMAIL PROTECTED] value="ognl:someusersetting" /></p>

ShowSettings.page has nothing defined in it, just the dtd, etc.




On 9/18/06, Onno Scheffers <[EMAIL PROTECTED]> wrote:
Peter Dawn schreef:

> guys,
>
> i have a form which a user fills in with their information. now when
> they click on submit, i want to display a confirmation page,
> displaying all the information the user has already filled in and once
> they confirm process the information.
>
> now how can i pass on information from one page to another. i mean
> somehow i need to send this information from the form page to the
> confirmation page and display it for confirmation.

Hi Peter,

have you tried this from your listener method on the Form Page?

YourConfirmationPage page = (YourConfirmationPage)
cycle.getPage("YourConfirmationPage");
page.setValue1(value1);
page.setValue2(value2);

or you could just put all properties into a bean and set everything at once.

Since the confirmation-page has no form-components (display-only) you
also need a way to pass the values on over the next submit (user
confirmation).
You can either use hidden values for that or make the properties persistent.

Regards,

Onno


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to