开发者

whats the practice to write a review page in JSF?

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 rev开发者_运维百科iew 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.


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 {
    // ...
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜