Questions tagged [jsf-2]

JavaServer Faces (JSF) is a model-view-presenter framework typically used to create web applications. Version 2.x is a major step ahead compared to JSF 1.x, significantly expanding the standard set of components and component libraries.

JavaServer Faces 2.x is a major step ahead as compared to JSF 1.x, significantly expanding the standard set of components and component libraries. Facelets (which was designed specifically for JavaServer Faces) was adopted as the official view technology for JSF 2.x. This eliminates the life-cycle conflicts that existed with JSP, forcing workarounds by Java developers. Lot of things which are hardly possible in JSF 1.x can be done more elegantly in JSF 2.x.

For the real wiki, please jump over to the wiki: https://stackoverflow.com/tags/jsf/info.

15731 questions
67
votes
20 answers

org.hibernate.AssertionFailure: null id in entry (don't flush the Session after an exception occurs)

I have a hibernate and JSF2 application going to the deployment server and suddenly throwing an org.hibernate.AssertionFailure: null id in exception. I will provide the stack trace and code immediately but here are four important issues first:…
Herzog
  • 923
  • 1
  • 14
  • 28
66
votes
2 answers

Defining and reusing an EL variable in JSF page

Is it possible to define variable and reuse the variable later in EL expressions ? For example : What i have in mind is…
Bertie
  • 17,277
  • 45
  • 129
  • 182
66
votes
5 answers

Is it possible to use JSF+Facelets with HTML 4/5?

Facelets relies on XML namespaces to work with XHTML. How are HTML 4, and as far as I know, HTML 5 do not support namespaces. Also HTML 5 has some new elements that are not available in XHTML. Even HTML 4 and XHTML have some differences regarding…
Behrang
  • 46,888
  • 25
  • 118
  • 160
64
votes
4 answers

How to reference CSS / JS / image resource in Facelets template?

I've done tutorial about Facelets templating. Now I've tried to create a page that isn't in same directory as the template. I've got problems with page style, because of styles are referenced with relative path like so:
kravemir
  • 10,636
  • 17
  • 64
  • 111
64
votes
4 answers

Get current page programmatically

In a JSF backing bean (Managed Bean, Weld Bean, doesn't matter), I can get the context path the client is on by calling FacesContext ctx = FacesContext.getCurrentInstance(); String path = ctx.getExternalContext().getRequestContextPath(); This…
Wolkenarchitekt
  • 20,170
  • 29
  • 111
  • 174
63
votes
3 answers

How to invalidate session in JSF 2.0?

What is the best possible way to invalidate session within a JSF 2.0 application? I know JSF itself does not handle session. So far I could find private void reset() { HttpSession session = (HttpSession) FacesContext.getCurrentInstance() …
Niks
  • 4,802
  • 4
  • 36
  • 55
59
votes
1 answer

Ajax update/render does not work on a component which has rendered attribute

I'm trying to ajax-update a conditionally rendered component. ...
59
votes
7 answers

List of events

I've searched the Internet and I cannot find a list of events. Can anyone provide a complete list of events for the tag? I'm particularly interested if there is an onblur event or something similar.
Catfish
  • 18,876
  • 54
  • 209
  • 353
57
votes
4 answers

Display dynamic image from database or remote source with p:graphicImage and StreamedContent

I'm trying to display image bytes which is saved in database as a StreamedContent in the as follows: private StreamedContent content; // getter and…
minhltnt
  • 571
  • 1
  • 5
  • 4
53
votes
1 answer

When to use f:view and f:subview

I am not sure what are the benefits of using and . I noticed that one could write JSF pages without using them. What are the benefits of using those tags?
Nick
  • 629
  • 1
  • 6
  • 9
53
votes
2 answers

What values can I pass to the event attribute of the f:ajax tag?

I am trying to find a list of all the possible values I can pass to the attribute event of the f:ajax tag. I know that I can also pass function names from my .js files, but what I need just the ones that come with JSF. I only know about click…
javing
  • 12,307
  • 35
  • 138
  • 211
52
votes
2 answers

How implement a login filter in JSF?

I would like to block the access of some page even if the user knows the url of some pages. For example, /localhost:8080/user/home.xhtml (need to do the login first) if not logged then redirect to /index.xhtml. How do that in JSF ? I read in the…
Valter Silva
  • 16,446
  • 52
  • 137
  • 218
52
votes
2 answers

how to debug JSF/EL

How to debug EL in the JSF page? I'd like to watch variable values, function calls an so on. The best solution would be an eclipse plugin, but any other possibility is better than guessing "Why this expression failed to render correctly?".
mrzasa
  • 22,895
  • 11
  • 56
  • 94
52
votes
1 answer

How to create a custom EL function to invoke a static method?

Im new to JSF 2. My question is related to BalusC's answer to this question jsf2 ajax update parts based on request parameters I tried the kickstart code BalusC posted and I encountered an EL parsing error: /nameofpage.xhtml @12,64…
royjavelosa
  • 2,048
  • 6
  • 30
  • 46
50
votes
2 answers

How to use in JSF page? Single form? Multiple forms? Nested forms?

I am using the Facelet Templating Technology to layout my page in a JSF 2 app that I am working on. In my header.xhtml, primefaces requires that menubar be enclosed in h:form. Menu Items…
Mark Estrada
  • 9,013
  • 37
  • 119
  • 186