EL and hibernate validation not working
troy.sellers Dec 18, 2008 11:55 PMHi All,
I am getting an exception when I try the to resolve the value of a jsf field using EL in the tag (i am using ice faces).
The tag value is resolved on the UI page, however when i submit the form it seems that the EL is not resolved before the setter on the backing bean is called.
We basically want to have the field label show up as a value inside the form, when the user clicks in the field the default value (the label) is removed so they can enter their data. If they tab out of this field, the label needs to be inserted again.
So, some code / log snippets...
An example of one of the input fields ...
<s:validateAll> <ice:inputText id="customerDetails_firstNameInput" value="#{customerDetails.firstName != null ? customerDetails.firstName : messages['customer.details.first.name.default']}" size="15" onfocus="javascript:clearInput(this, '#{messages['customer.details.first.name.default']}');" onblur="javascript:populateWithDefault(this, '#{messages['customer.details.first.name.default']}');" /> </s:validateAll>
The backing bean is simple getter and setter.
Submitting the form causes the following validation errors
09:50:31,717 INFO [EARDeployer] Started J2EE application: file:/C:/java/jbdevstudio/jboss-eap/jboss-as/server/default/deploy/matadorLite-EAR.ear/ 09:52:43,933 INFO [Contexts] starting up: org.jboss.seam.web.session 09:52:43,933 INFO [Contexts] starting up: org.jboss.seam.security.identity 09:52:43,980 INFO [AsyncServerDetector] Asynchronous HTTP Service available: false 09:52:43,980 INFO [AsyncServerDetector] JMS API available: true 09:52:43,980 INFO [AsyncServerDetector] Adapting to Send Updated Views environment. 09:52:45,402 INFO [STDOUT] Hibernate: select configpara0_.paramKey as paramKey153_, configpara0_.paramValue as paramValue153_ from dbo.ConfigParam configpara0_ 09:52:45,761 INFO [OrderTypeActions] Destroying [class com.yum.matador.action.OrderTypeActions] 09:52:48,714 INFO [lifecycle] WARNING: FacesMessage(s) have been enqueued, but may not have been displayed. sourceId=j_id126:customerDetails_firstNameInput[severity=(ERROR 2), summary=(model validation failed:/customerDetails.xhtml @24,10 value="#{customerDetails.firstName != null ? customerDetails.firstName : messages['customer.details.first.name.default']}": Illegal Syntax for Set Operation), detail=(model validation failed:/customerDetails.xhtml @24,10 value="#{customerDetails.firstName != null ? customerDetails.firstName : messages['customer.details.first.name.default']}": Illegal Syntax for Set Operation)] sourceId=j_id126:customerDetails_surnameInput[severity=(ERROR 2), summary=(model validation failed:/customerDetails.xhtml @30,10 value="#{(customerDetails.surname != null ? customerDetails.surname : messages['customer.details.surname.default'])}": Illegal Syntax for Set Operation), detail=(model validation failed:/customerDetails.xhtml @30,10 value="#{(customerDetails.surname != null ? customerDetails.surname : messages['customer.details.surname.default'])}": Illegal Syntax for Set Operation)] sourceId=j_id126:customerDetails_phoneInput[severity=(ERROR 2), summary=(model validation failed:/customerDetails.xhtml @35,20 value="#{(customerDetails.phoneNumber != null ? customerDetails.phoneNumber : messages['customer.details.phone.default'])}": Illegal Syntax for Set Operation), detail=(model validation failed:/customerDetails.xhtml @35,20 value="#{(customerDetails.phoneNumber != null ? customerDetails.phoneNumber : messages['customer.details.phone.default'])}": Illegal Syntax for Set Operation)] sourceId=j_id126:customerDetails_emailInput[severity=(ERROR 2), summary=(model validation failed:/customerDetails.xhtml @40,20 value="#{(customerDetails.emailAddress != null ? customerDetails.emailAddress : messages['customer.details.email.default'])}": Illegal Syntax for Set Operation), detail=(model validation failed:/customerDetails.xhtml @40,20 value="#{(customerDetails.emailAddress != null ? customerDetails.emailAddress : messages['customer.details.email.default'])}": Illegal Syntax for Set Operation)] 09:52:48,714 INFO [OrderTypeActions] Destroying [class com.yum.matador.action.OrderTypeActions]
It seems that my EL is not being evaluated before calling the Setter of the backing bean? Is this the case? How can I fix this?
Cheers,
Troy