tags:

views:

17

answers:

1

I have a JSF Page which gets few inputs from the User, I want to show a review page to the user - as what he has given as inputs in the previous page. I am using h:OutputText in the review page to show all the inputs the User had given - but when the user has reviewed and if the user wants to save them - I have a commandButton which is bound to an action method in the backing bean - which will not submit any values as the outputTexts are not submitted. What are the options do I have to show a review page at the same time get the values at the server side - I dont want to have the bean session-scoped.

I am using Apache My faces Implementation of JSF 1.2 without any component libs.

+1  A: 

You can use h:inputHidden to retain data for the subsequent POST request. E.g.

<h:outputText value="#{bean.property}" />
<h:inputHidden value="#{bean.property}" />

When you don't have an aversion against component libraries, I'd have suggested Tomahawk's t:saveState for this. This way you don't need to specify every property separately in a hidden field.

<t:saveState value="#{bean}" />

When you're already on JSF 2.0, just putting the bean in the view scope would have been sufficient (assuming that you're conditionally rendering input form and review form in the same view). This way it lives as long as you're interacting with the same view.

@ManagedBean
@ViewScoped
public class Bean {
    // ...
}
BalusC
Thanks BalusC. If I have a datatable with many columns in the review page, How do i take those values to the server side?UIData#getDataModel is the only way?
gurupriyan.e
No. Just have a `h:inputHidden` for each model property. JSF will update the model values accordingly. You just access the model (the bean property bound by `value` attribute) the usual way.
BalusC