Questions tagged [viewparams]

JSF tag to declare a GET parameter.

"View parameters" is a JSF specific term for GET request parameters which can be set on the model by the <f:viewParam> JSF UI component on the view. They follow the same lifecycle as regular UIInput components, complete with support for declarative conversion and validation and message handling.

Frequently asked questions

108 questions
157
votes
2 answers

What can , and be used for?

Can anyone clarify how we can use in general, or a in real world example, this snippet?
Hanynowsky
  • 2,970
  • 5
  • 32
  • 43
101
votes
2 answers

ViewParam vs @ManagedProperty(value = "#{param.id}")

What is the difference between defining View Params like this: And defining the property in the ManagedBean like this: @Inject @ManagedProperty(value =…
ehsun7b
  • 4,796
  • 14
  • 59
  • 98
13
votes
2 answers

JSF2 redirect with includeViewParams allows users to enter EL expression which are resolved into text fields

I have a JSF2 XHTML page that defines view parameters, this allows one to have bookmarkable URLs. The XHTML page includes the parameters:
Rasmus Franke
  • 4,434
  • 8
  • 45
  • 62
12
votes
1 answer

JSF bean: call @PostConstruct function after ViewParam is set

I have a product.xhtml and a ProductBean. I use /product/{id} to access the products so I have a viewParam in product.xhtml with value=ProductBean.id. The problem is that inside the bean I use an init function with a PostConstruct annotation in…
user579674
  • 2,159
  • 6
  • 30
  • 40
8
votes
1 answer

JSF f:viewParam not calling setter if located in template.xhtml

Perhaps somebody can enlighten me. If putting inside a template, the setter setValue is never called, i.e. the preRender method 'call()' is called without prior call to…
hpgisler
  • 125
  • 2
  • 6
8
votes
2 answers

Submit a JSF form using GET

How do I submit a form to the same page and use GET parameters? JSF page contents: ...
monkey_wrench
  • 81
  • 1
  • 2
8
votes
1 answer

includeViewParams=true converts null model value to empty string in query string

Given a as follows.
Tiny
  • 27,221
  • 105
  • 339
  • 599
7
votes
1 answer

Automatically include view parameters in URL

I have simple jsf page with view params and load method which is processing those params:
karolkpl
  • 2,189
  • 10
  • 39
  • 60
7
votes
1 answer

Validation/conversion errors of do not localize to , but to default locale

I have an tag on JSF pages that sets GET parameters to the corresponding managed bean after conversion and validation. If either conversion or validation errors occur, then an appropriate error message is fetched from a resource bundle…
Tiny
  • 27,221
  • 105
  • 339
  • 599
7
votes
1 answer

The metadata component needs to be nested within a f:metadata tag. Suggestion: enclose the necessary components within

I went through different sources like: Error saying I need to use f:metadata even though I do http://docs.oracle.com/javaee/7/javaserverfaces/2.2/vdldocs/facelets/f/metadata.html and it seems to be issue has been fixed in jsf 2.2.1, where as When…
Jayaram
  • 1,715
  • 18
  • 30
6
votes
1 answer

View-scoped bean recreated on POST when URL parameters not used

I have a view-scoped JSF-managed bean that's backing an xhtml view where I read one parameter from the URL using f:viewParam. The view presents a form to the user. However, when the user submits the form by pressing the p:commandButton it seems that…
Marcus Junius Brutus
  • 26,087
  • 41
  • 189
  • 331
5
votes
1 answer

f:viewParam with multiple values

I have a driven search screen. I am trying to implement it to take multiple values for a single . I believe the correct URL would look something like ?state=COMPLETE&state=PENDING The XHTML section is as…
fransvn
  • 273
  • 1
  • 5
  • 15
5
votes
1 answer

JSF ViewParam Required +AJAX breaks page

When I click the command button on the page below navigations fails. (Clicking on the button refreshes the page, removes the URL parameter and displays the required error message instead of navigating to the index page) However if I remove the…
DD.
  • 21,498
  • 52
  • 157
  • 246
5
votes
1 answer

Set f:viewParam property to null when there is no parameter in URL

Let's assume we got simple page that accepts one parameter: When user goes to http://localhost/myapp/?name=Joe, then #{bean.name} is set to Joe. Then if user goes to http://localhost/myapp/ or…
karolkpl
  • 2,189
  • 10
  • 39
  • 60
1
2 3 4 5 6 7 8