jsf - p:commandButton action throws javax.el.PropertyNotFoundException -
the error in:
javax.el.propertynotfoundexception: /index.xhtml: property 'validar' not found on type fya.beanpages.indexbean
its looks doesnt find validar method. , thinks attribute.
this 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 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 think im doing wrong, can me please?
that can happen when didn't install primefaces. way <p:xxx>
tags treated template text (meaning, not parsed jsf components facelets printed plain vanilla straight html output). el expressions in template text default resolved property value expressions (like in <p>blah #{bean.foo} blah</p>
) requires getter method. el expressions represent method expression throw exception because there's no getter found in bean.
to install primefaces, make sure jar file in webapp's /web-inf/lib
(if you're using ide eclipse, make sure absolutely not touch build path setting, if ever fiddled there in careless attempt solve it, undo all!), , make sure project rebuilt , server's work folder cleant , deploy in server contain primefaces jar file in right place.
another thing take account, taglib uri http://primefaces.org/ui
introduced in primefaces 3.0. if happen have jar of primefaces 2.x or older, can face problem. you'd need either upgrade primefaces @ least 3.0, or fall using 2.x compatible taglib uri http://primefaces.prime.com.tr/ui
.
Comments
Post a Comment