14753

p:commandButton action throws javax.el.PropertyNotFoundException

Question:

The error is in:

<blockquote>

javax.el.PropertyNotFoundException: /index.xhtml: Property 'validar' not found on type fya.beanpages.IndexBean

</blockquote>

Its looks like it doesnt find the validar method. And it thinks it is an attribute.

This is the xhtml:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui"> <h:head> <title>FYA WEB</title> </h:head> <h:body> <ui:composition template="/base/base.xhtml"> <ui:param name="title" value="FYA Web Login"/> <ui:define name="content"> <h:form id="form"> <p:panel id="panel" header="Inicio Sesión"> <p:messages id="panelmsg"/> <h:panelGrid columns="3"> <h:outputLabel for="nomUsuario" value="Usuario: *" /> <p:inputText id="nomUsuario" value="#{login.usu.nomusuario}" required="true" label="Usuario"/> <h:outputLabel for="pwdUsuario" value="Contraseña: *" /> <p:password id="pwdUsuario" value="#{login.usu.contraseña}" label="Contraseña" required="true"/> </h:panelGrid> <p:commandButton id="btnIniciar" value="Iniciar Sesión" action="#{login.validar}" update="panelmsg" ajax="true"/> </p:panel> </h:form> </ui:define> </ui:composition> </h:body>

This is the managed Bean.

package pe.edu.cibertec.managed; @ManagedBean(name="login") public class LoginBean { private Usuario usuario=new Usuario(); private static LoginService loginService= new LoginServiceImpl(); public Usuario getUsuario() { return usuario; } public void setUsuario(Usuario usuario) { this.usuario = usuario; } public String validar() throws Exception { if(loginService.validar(usuario)) return "paginas/principal"; else{ FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Datos Incorrectos")); return null; } } }

Maybe i think im doing something wrong, can you help me please?

Answer1:

That can happen when you didn't properly install PrimeFaces. This way all <p:xxx> tags are treated as template text (meaning, they are not parsed as JSF components by Facelets but printed plain vanilla straight to HTML output). All EL expressions in template text are by default resolved as property value expressions (like as in

blah #{bean.foo} blah

) which requires a getter method. All EL expressions which initially represent a method expression would then throw exactly this exception because there's no getter found in the bean.

To properly install PrimeFaces, make sure that the JAR file is in webapp's /WEB-INF/lib (if you're using any IDE like Eclipse, make sure that you absolutely do not touch <em>Build Path</em> setting, if you ever fiddled there in a careless attempt to solve it, undo it all!), and make sure that the project is properly rebuilt and that the server's work folder is properly cleant up and that the deploy in the server does contain the PrimeFaces JAR file in the right place.

Another thing to take into account, the taglib URI http://primefaces.org/ui was introduced in PrimeFaces 3.0. So if you happen to have a JAR of PrimeFaces 2.x or older, then you can also face exactly this problem. You'd need to either upgrade PrimeFaces to at least 3.0, or to fall back to using 2.x compatible taglib URI http://primefaces.prime.com.tr/ui.

Recommend

  • change font size with javascript
  • JPanel Image Background Overlapping Other JPanel
  • Active link after click [duplicate]
  • EF7 Identity not loading User extended properties
  • Populate in Mongoose
  • Richfaces editable dataTable not setting updated values in Bean
  • How to send message to news feed with facebook sdk php
  • Render the Components after the click
  • does not update target component, but works fine [duplicate]
  • Exclude field from a form in JSF
  • Target Unreachable, identifier 'demoBean' resolved to null [duplicate]
  • java.lang.IllegalArgumentException: Setter not found for property class
  • How to sort SimpleXMLElement on PHP
  • What is the JSF behaviour, if you bind the same backing bean property to two input fields in the sam
  • VB.NET: How do I use coalesce with db column values and nullable types? Or is there a better solutio
  • ValueError: Found arrays with inconsistent numbers of samples
  • How to remove comma or any characters from Python dataframe column name
  • Skip Characters in Oracle TO_DATE function
  • Table striping rows in CSS Grid
  • Error in GGally: Error in unit(tic_pos.c, “mm”) : 'x' and 'units' must have leng
  • Using an array for autofilter criteria
  • HighCharts - Show tooltip on column where value is 0 or null
  • Can I update/select from a table in one query?
  • If I am creating a simple client server application in IntelliJ, how should this work?
  • Bound DataGridViewCheckBoxColumn not updating binding source
  • Cuda Clang and OS X Mavericks
  • Exception gevent.hub.LoopExit: LoopExit('This operation would block forever',)
  • WPF version of .ScaleControl?
  • Primefaces :radioButton inside a ui:repeat
  • R convert summary result (statistics with all dataframe columns) into dataframe
  • saving file generated by TCPDF
  • How to view images from protected folder with php?
  • Breaking out column by groups in Pandas
  • Unable to get column index with table.getColumn method using custom table Model
  • Textfile Structure (tables)
  • Is there a way to do normal logging with EureakLog?
  • Recording logins for password protected directories
  • Is there any way to access browser form field suggestions from JavaScript?
  • vba code to select only visible cells in specific column except heading
  • Getting error when using KSoap library to consume .NET web services