Bean could not be created on the Seam Project
ekusnady Jul 10, 2009 3:46 PMHello all,
i am a newbi in Seam-programming.
I already could make a Hello Seam on JBoss. But it's only the first step. I still have to learn many things.
Now i am trying to make an input Text where user can type a name and then beside this Input Text, the name they typed, will be shown.
So first,of course i make a java project named Bean.
My Bean.java is
package model; public class Bean { public String text; public Bean() { } public String getText() { return text; } public void setText(String text) { this.text = text; } }
And i make a new .xhtml file named hello.xhtml. It looks like this
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:rich="http://richfaces.org/rich" template="layout/template.xhtml" xmlns:a4j="http://richfaces.org/a4j"> <ui:define name="body"> <h1>Welcome to Seam!</h1> <rich:panel> <h:panelGrid columns="2"> <h:graphicImage value="/img/seamlogo.png" alt="Seam logo"/> <s:div styleClass="info"> <h:commandButton value="Hello" size="50" style=" width : 129px; height : 60px;"/> <h:inputText value="#{bean.text}"/> <a4j:support event="onkeyup" reRender="rep"/> <h:outputText value="#{bean.text}" id="rep"/> </s:div> </h:panelGrid> </rich:panel> </ui:define> </ui:composition>
And into my face-config.xml i add this code
<managed-bean> <managed-bean-name>bean</managed-bean-name> <managed-bean-class>model.Bean</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> <managed-property> <property-name>text</property-name> <property-class>java.lang.String</property-class> <value/> </managed-property> </managed-bean>
And i didn't add anything onto web.xml.
I deployed it...
But in the webbroser i got this :
An Error Occurred:
javax.faces.FacesException: Cant instantiate class: model.Bean.. model.Bean
Stack Trace
Component Tree
Scoped Variables
And in the console there was an error:
Managedbean bean could not be created.
Could anyone please help me?
I am really new here ..
It would be my pleasure to get any feedback from you.
Thank you