jsf-2.0

JSF 2 - Bean Validation: validation failed -> empty values are replaced with last valid values from managed bean

Hello. I do not understand the behaviour of JSF2 during valdation. Hope someone can help me. I have a form where the fields are validated after (ajax) submit - ok If the validation failed a error message is shown - ok For my example when I enter a valid birthday and the field name is empty an errormessage for name is shown after subm...

Mixing JSP and XHTML (Facelets) in JSF2 Project - possible?

I have a client who wants to use JSF2 and they like that XHTML is now the default (Facelets). However, they have a huge amount of "legacy" JSP from their JSF1.x codebase. I know it's probably not desirable, but will it be possible to support a mix of both in JSF2, at least for a transition period whilst they port? I know it was possib...

Long poll for JSF - what are the choices?

I need to implement long-poll for a notification system, I current using Primefaces ajax framework but currently does not support long poll. I just wondering what is available for JSF developer if they want to implement long poll? Another question: between long poll and web push, for notification system, which one is prefer? Note: I am ...

Bizarre bug: inputTextarea only hook its value to the last row in dataTable

The bug is the inputTextarea I have below. Only the last row can record any input from the inputTextarea, in other word, only the last row, hook it value to #{PostComment.comment.comment}. Why is this? <h:form id="userCommentList" > <p:dataTable value="#{CentralFeed.profileComments}" var="item"> <p:column> ...

how to use google recaptcha in jsf2

how to use google recaptcha in jsf2. I am using richfaces too. Please don't suggest primefaces. ...

Redirecting Icefaces page from an independent thread?

I'm performing a validation task that takes a while and am spinning the validation process into a separate thread. I've got the progress bar side of things working, with PortableRenderer and a ViewScope allowing it to update the progress bar component. However, I'm trying to redirect the user once the page either finishes or a error in...

JSF- passing a parameter to valuechangelistener

Hello, I have a litte radiobutton like this : <h:selectOneRadio value="#{test.answer}" valueChangeListener="#{TestService.changeanswer}" immediate="true" id="answer"> <f:selectItem itemValue="A" itemLabel="Absolutely True"/> <f:selectItem itemValue="B" itemLabel="True"/> <f:selectItem itemValue="C" itemLabel="Partially True"/> <...

Use GET request for form submission in JSF 2.0

Is there a way to submit a form and have the URL include the parameters, that is submit as a GET request.. rather than POST? form.jsf/?firstName=John&lastName=Doe I thought would work (instead of the normal , however it doesn't seem to grab the form data.. any ideas? ...

How to change the value in h:commandlink onclick

Hi, I need to implement h:commandlink in my project. I need to change the value "Follow" to "Following" in the commandlink once the user clicks it. How do i do that? Can someone help me with this? Thanks for your time and help in advance. <h:commandlink id="followdoc" action="Usermanger.followdoctor" value="Follow" /> Usermanager is...

NetBeans 6.9.1 demo (ScrumToys) - JSF 2.0 not rendered in Internet-explorer

In ScrumToys web-application (NetBeans JSF 2.0 demo) the .jsf page is not renderend in internet-explorer (I see the page source as XML). This works fine in 'proper' browsers, like Chrome and FireFox. I'm using the ScrumToys demo app provided by NetBeans 6.9.1 (running on GlassFish 3) with absolutely no changes. I'm using Internet-explor...

<h:dataTable value=#{myBean.xxx}>: getXxx() get called so many times, why?

Simple piece of code about dataTable. CentralFeed is SessionScoped Bean, and PostComment is RequestScoped Bean <h:form id="table"> <h:dataTable value="#{CentralFeed.profileComments}" var="item"> <h:column> <h:outputText value="#{item.comment}"/><br/> <h:inputTextarea value="#{item.newComment}" rows="2...

JSF 2.0: Is there any advantage in using DataModel<T> over List<T> for CRUD applications

One advantage of the datamodel is that you get the row index in a table. But I find this unnecessary, since you can access the current row element using the var attribute of h:datatable. And I often need to convert to the datamodel to list, since some component libraries are expecting a list. I am thinking of completely abandoning DataMo...

REST and JSF: Library to use? How to solve it?

The problem: When the user clicks on www.example.com/myapp/myview?id=1 I need to display the item with id=1 which is in the database. To do that I need to execute bean methods. (Ideally the user would have to login first if not in cookies and then redirect but that's another problem). I'm using Richfaces 3.3.3 with JSF 2.0 (So VDL is d...

JSF Limitations

I'm currently just exploring JSF 2 in the JEE 6 stack. I find quite a bit of limitations with JSF and the way ManagedBeans are used is very counter-intuitive / odd: It seems that, in order to execute an action event, you have to use <h:commandLink> tag. Thats all well if I was for example, posting form data. However in this case, all I...

How to display menu items from database

I have two classes representing menu items. First one is Category, it represents the parent menu items. @Entity @Table(name = "category") @NamedQueries({ @NamedQuery(name = "Category.findAll", query = "SELECT c FROM Category c"), @NamedQuery(name = "Category.findByCateId", query = "SELECT c FROM Category c WHERE c.cateId = :cat...

JSF2 and JSR 311 (aka REST specification)

In the drafts of JSF2 one of the goals was to implement JSR 311 (aka REST features). But there is no documentation about it or if it's already implemented in JSF2 or how to use it. Any more info about this? Thanks. Update I've found this artice from Andy Schwartz about what's new in JSF2 with some examples. I think that JSF2 does n...

JSF2: selectOneMenu with custom selectItems: all items are selected

Thanks to some great articles here, I've been able to build a <h:selectOneMenu /> with selectItems containing objects. After providing a custom FacesConverter and fixing the missing equals()/hashcode() methods, I am able to use it to change the property of the backing bean and write it out to the DB. The only weird thing is that all HTM...

CAS authentication and limiting access for specified users

Hi, I'm using CAS (Central Authentication Service) from Jasig in a client JSF app running on tomcat 6 server. I would like to limit the access to the app just for the users specified in my database rather than all the users which can be authenticated using that CAS service. When the user attempts to log in, I need to check if his userna...

JSF2 Validation Clientside or Serverside?

Hi folks, I implemented my validation logic as follows: <h:inputText id="title" value="#{...}" required="true" requiredMessage="...some..text..." validatorMessage="...some..other..text..." > <f:validateLength minimum="10" maximum="50"/> </h:inputText> I read a lot about clientside...

Retrieving Blob from MySQL database in Hibernate / JSF application

I am having some trouble properly retrieving blob data from my database using java in my JSF 2.0 application. The first problem I am having is on my getter method for the Blob named "file" I get an error saying that "Basic attributes can only be of the following types..." basically saying that I can not return a Blob object. My code look...