Property in ManagedBean nicht gefunden?

Fantasma

Aktives Mitglied
Hallo Forum...

Ich hab was gebastelt und es hat funktioniert. Dann habe ich ein paar Tags von h: auf p: geaendert und es hat immer noch funktioniert.... dann habe ich sie wieder von p: auf h: geaendert und auf einmal heisst es "Property 'nuevoUsuario' not found on type com.presentacion.usuarios.login.LoginBean".

Ich weis wirklich nicht mehr wo ich noch groß nach dem Fehler suchen soll... ;(

(warum macht der server das, das der von einem moment auf dem anderen...)

Kann sich das vielleicht jemand kurz mal anschauen?

Vielen dank schon mal 🙂

HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.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:p="http://primefaces.prime.com.tr/ui">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Welcome to UsuarioNet</title>
</head>


<h:head>
  <title>Login</title>
</h:head>
<h:body>
   <h:form>
    <h2>Login: </h2>
    <h:messages />
    <table>
      <tr>
        <td>Login:</td>
        <td>
          <h:inputText 	label="login"
          				value="#{LoginBean.login}"
          				id="login"
          				required="true"/>
          <h:message for="login" />
        </td>
      </tr>
      <tr>
        <td>Password:</td>
        <td>
          <h:inputText 	label="password"
          				value="#{LoginBean.password}" 
          				id="password"
          				required="true"/>
          <h:message for="password" />
        </td>
      </tr>
    </table>
  	<p><h:commandButton value="Login" action="#{LoginBean.login}" immediate="false"/></p>
  	<p><h:commandButton value="Nuevo Usuario" action="#{LoginBean.nuevoUsuario}" immediate="true"/></p>
  </h:form>
  
  
 <!--<h:form prependId="false">  
  
    <p:panel id="panel" header="New User" style="margin-bottom:10px;">  
        <p:messages />  
        <h:panelGrid columns="3">  
            <h:outputLabel for="login" value="Login: *" />  
            <p:inputText id="login"   
                value="#{LoginBean.login}" required="true" label="Login">   
            </p:inputText>  
            <p:message for="login" />  
              
            <h:outputLabel for="password" value="Password: *" />  
            <p:inputText id="password"   
                value="#{LoginBean.password}" required="true" label="Password"/>  
            <p:message for="password" />  
        </h:panelGrid>  
    </p:panel>  
  
    <p:commandButton value="Ajax Submit" update="panel,display"  
             actionListener="#{LoginBean.nuevoUsuario}" />  
                 
    <p:commandButton value="Non-Ajax Submit" action="#{LoginBean.nuevoUsuario}"   
            ajax="false" />  
      
    <p:commandButton value="With Icon" action="#{LoginBean.nuevoUsuario}"   
            update="panel,display" image="ui-icon ui-icon-disk" />  
      
    <p:commandButton action="#{LoginBean.nuevoUsuario}" update="panel,display"   
            image="ui-icon ui-icon-disk" title="Icon Only"/>  
      
    <p:commandButton value="Disabled" disabled="true" />  
      
    <p:panel id="display" header="Information" style="margin-top:10px;">  
        <h:panelGrid columns="2">  
            <h:outputText value="Firstname: " />  
            <h:outputText value="#{LoginBean.login}" />  
              
            <h:outputText value="Surname: " />  
            <h:outputText value="#{LoginBean.password}" />  
        </h:panelGrid>  
    </p:panel>  
      
</h:form> -->
</h:body>
</html>

und die LoginBean:
Java:
package com.presentacion.usuarios.login;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

@ManagedBean(name="LoginBean" )
@ViewScoped
public class LoginBean {
	private String login;
	private String password;
	
	public String login(){
		// para logearse 
		return "menu";
	}
	
	public String nuevoUsuario(){
		// para registrarse
		return "/view/login/registrar1.xhtml";
	}
	
	
	
	public String getLogin() {
		return login;
	}
	public void setLogin(String login) {
		this.login = login;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	
	
	

}

Wie gesagt das hat alles schon mal genau so funktioniert wie es soll. Ich hab nicht das package gewechselt, kein attribut umbenannt, an der bean eh nichts geaendert... an der web.xml sowieso nicht.... nichts... und wie jeder nur unschwer erkennen kann ist da eindeutig eine methode die da nuevoUsuario heisst... langsam verzweifle ich hier....
 
Ansonsten find ich es noch ungünstig, das du sowohl einen getter für das Attribut login als auch eine Methode login() hast. Das verwirrt ungemein zumal in der .xhtml Datei ja immer model.login steht.
 
Hallo:
Danke fuer eure tips. Ich hab den zusaetzlichen Eintrag in der web.xml vorgenommen:
[XML]<context-param>
<param-name>facelets.SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>[/XML]

Und es funktioniert jetzt zum Glueck. (Wieso verliehre ich wegen solchen kleinen dingen nur immer so viel zeit??)

Das mit dem "doppelten" login war mir gar nicht aufgefallen aber ich finde du hast recht, danke auch fuer den hint. 🙂

Eine kleinigkeit vielleicht noch. In der ersten Zeile im xhtml code oben, da steht:
[XML]<html xmlns="http://www.w3.org/1999/xhtml"[/XML] usw... (interessant ist glaub ich nur diese zeile)
und Eclypse mahcht mir da eine warnung daneben:
"Undefined attribut name xmlns."
Es scheint bisher keine Auswirkungen zu haben. Aber was bedeutet das und warum erscheint das?

Danke schon mal.
Fantasma
 

Neue Themen


Zurück
Oben