gpt4 book ai didi

jsp - 无法将类 java.lang.String 类型的 #{ad.userid} 转换为类 javax.faces.component.UIComponent

转载 作者:行者123 更新时间:2023-12-01 01:33:43 25 4
gpt4 key购买 nike

我正在访问主页,但是在访问具有 h:inputText 的 JSP 页面时我收到以下错误:

根本原因
javax.servlet.ServletException: javax.servlet.jsp.JspException: org.apache.jasper.el.JspELException:/login.jsp(21,0) '#{ad.userid}' 无法转换 #{ad.userid}将 class java.lang.String 输入到 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)

根本原因

org.apache.jasper.el.JspELException:/login.jsp(21,0) '#{ad.userid}' 无法将类 java.lang.String 类型的 #{ad.userid} 转换为类 javax.faces.component .UI组件
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)

最佳答案

login.jsp 的第 21 行, 代替

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

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

要了解原因和内容 binding属性用于, head here .

关于jsp - 无法将类 java.lang.String 类型的 #{ad.userid} 转换为类 javax.faces.component.UIComponent,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3246314/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com