tags:

views:

54

answers:

1

I am getting home page, but when going to a JSP page which has a h:inputText I am getting the following error:

root cause
javax.servlet.ServletException: javax.servlet.jsp.JspException: org.apache.jasper.el.JspELException: /login.jsp(21,0) '#{ad.userid}' Cannot convert #{ad.userid} of type class java.lang.String to class javax.faces.component.UIComponent
 org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858)
 org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
 org.apache.jsp.login_jsp._jspService(login_jsp.java:83)
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:542)
 com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:359)
 com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:150)
 com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:96)
 com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
 com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:135)
 javax.faces.webapp.FacesServlet.service(FacesServlet.java:309)

root cause

org.apache.jasper.el.JspELException: /login.jsp(21,0) '#{ad.userid}' Cannot convert #{ad.userid} of type class java.lang.String to class javax.faces.component.UIComponent
 org.apache.jasper.el.JspValueExpression.getValue(JspValueExpression.java:107)
 com.sun.faces.application.ApplicationImpl.createComponentApplyAnnotations(ApplicationImpl.java:1878)
 com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:443)
 javax.faces.webapp.UIComponentELTag.createComponent(UIComponentELTag.java:218)
 javax.faces.webapp.UIComponentClassicTagBase.createChild(UIComponentClassicTagBase.java:483)
 javax.faces.webapp.UIComponentClassicTagBase.findComponent(UIComponentClassicTagBase.java:667)
 javax.faces.webapp.UIComponentClassicTagBase.doStartTag(UIComponentClassicTagBase.java:1139)
 com.sun.faces.taglib.html_basic.InputTextTag.doStartTag(InputTextTag.java:424)
 org.apache.jsp.login_jsp._jspx_meth_h_005finputText_005f0(login_jsp.java:253)
 org.apache.jsp.login_jsp._jspx_meth_h_005fform_005f0(login_jsp.java:168)
 org.apache.jsp.login_jsp._jspx_meth_f_005fview_005f0(login_jsp.java:113)
 org.apache.jsp.login_jsp._jspService(login_jsp.java:76)
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:542)
 com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:359)
 com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:150)
 com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:96)
 com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
 com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:135)
 javax.faces.webapp.FacesServlet.service(FacesServlet.java:309)

A: 

In line 21 of login.jsp, replace

<h:inputText binding="#{ad.userid}" />

by

<h:inputText value="#{ad.userid}" />

To learn why and what the binding attribute is for, head here.

BalusC
thank u .i am getting but the input fields are filled with #{ad.userid} like that in any pages.and also even though i entered valid values to them they are getting null values in managed beanplease reply
john
If your **current** question/problem is answered/solved, you should mark this answer accepted (tick the checkmark on left hand side). If you have a **new** question, you should press the `Ask Question` button at the right top to post it, do not abuse comments or others' questions/answers for it :) See also http://stackoverflow.com/faq
BalusC