Note that there are some explanatory texts on larger screens.

plurals
  1. POError while submitting on page - JSF2 + tomcat 6
    text
    copied!<p>I 'm new to JSF and creating a sample app using jsf2,tomcat6.0 using eclipse kepler.I 'm getting below exception when i click on ubmit button :</p> <pre><code>SEVERE: Error Rendering View[/index.xhtml] com.sun.faces.mgbean.ManagedBeanCreationException: Unable to create managed bean helloWorldBean. The following problems were found: - Bean or property class com.vigilance.jsf for managed bean helloWorldBean cannot be found. at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:265) at com.sun.faces.el.ManagedBeanELResolver.resolveBean(ManagedBeanELResolver.java:244) at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:116) at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176) at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203) at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:69) at org.apache.el.parser.AstValue.getValue(AstValue.java:112) at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186) at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109) at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194) at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182) at javax.faces.component.UIOutput.getValue(UIOutput.java:169) at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:205) at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:355) at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:164) at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:924) at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:312) . </code></pre> <p><strong>My web.xml is below :</strong></p> <pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"&gt; &lt;display-name&gt;JavaServerFaces&lt;/display-name&gt; &lt;context-param&gt; &lt;param-name&gt;javax.faces.PROJECT_STAGE&lt;/param-name&gt; &lt;param-value&gt;Development&lt;/param-value&gt; &lt;/context-param&gt; &lt;!-- Welcome page list --&gt; &lt;welcome-file-list&gt; &lt;welcome-file&gt;index.xhtml&lt;/welcome-file&gt; &lt;/welcome-file-list&gt; &lt;!-- JavaServer Faces Servlet --&gt; &lt;servlet&gt; &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt; &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt; &lt;load-on-startup&gt;1&lt;/load-on-startup&gt; &lt;/servlet&gt; &lt;!-- Servlet Mapping to URL pattern --&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt; &lt;url-pattern&gt;*.xhtml&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt; &lt;url-pattern&gt;*.jsf&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt; &lt;url-pattern&gt;*.faces&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;/web-app&gt; </code></pre> <p><strong>Managedbean - HelloWorldBean.java:</strong></p> <pre><code>package com.vigilance.jsf; import java.io.Serializable; import javax.faces.bean.ManagedBean; import javax.faces.bean.RequestScoped; import javax.faces.bean.SessionScoped; @ManagedBean(name="helloWorldBean") @SessionScoped public class HelloWorldBean implements Serializable { /** * */ private static final long serialVersionUID = 1L; private String firstName; private String lastName; public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } } </code></pre> <p><strong>xhtml files - index.xhtmls</strong></p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"&gt; &lt;f:loadBundle basename="resources.application" var="msg" /&gt; &lt;head&gt; &lt;title&gt; &lt;h:outputText value="#{msg.welcomeTitle}" /&gt; &lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;h3&gt; &lt;h:outputText value="#{msg.welcomeHeading}" /&gt; &lt;/h3&gt; &lt;p&gt; &lt;h:outputText value="#{msg.welcomeMessage}" /&gt; &lt;/p&gt; &lt;h:form&gt; &lt;h:panelGrid columns="2"&gt; &lt;h:outputLabel for="firstName"&gt; First Name * &lt;/h:outputLabel&gt; &lt;h:inputText id="firstName" value="#{helloWorldBean.firstName}"&gt; &lt;/h:inputText&gt; &lt;h:outputLabel for="lastName"&gt; Last Name * &lt;/h:outputLabel&gt; &lt;h:inputText id="lastName" value="#{helloWorldBean.lastName}"&gt; &lt;/h:inputText&gt; &lt;h:commandButton value="Submit" action="hello"&gt;&lt;/h:commandButton&gt; &lt;/h:panelGrid&gt; &lt;/h:form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong>hello.xhtml</strong></p> <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1" ?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"&gt; &lt;f:loadBundle basename="resources.application" var="msg" /&gt; &lt;head&gt; &lt;title&gt; &lt;h:outputText value="#{msg.welcomeTitle}" /&gt; &lt;/title&gt; &lt;/head&gt; &lt;h:body&gt; &lt;h3&gt; &lt;h:outputText value="#{msg.helloHeading}" /&gt; &amp;nbsp;#{helloWorldBean.firstName}&amp;nbsp;#{helloWorldBean.lastName} &lt;/h3&gt; &lt;p&gt; &lt;h:outputText value="#{msg.helloMessage}" /&gt; &lt;/p&gt; &lt;/h:body&gt; &lt;/html&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload