在 JSF1.1 中使用带有 DataTable 的自定义组件时出现重复 ID 错误
当我尝试返回同一页面而不重定向时,出现以下错误。
org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: java.lang.IllegalStateException: Duplicate component ID '_id20' found in view.
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:527)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:401)
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:346)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:152)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:107)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:137)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:214)
org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
root cause
javax.servlet.ServletException: javax.servlet.jsp.JspException: java.lang.IllegalStateException: Duplicate component ID '_id20' found in view.
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
org.apache.jsp.view_005fneed_jsp._jspService(view_005fneed_jsp.java:556)
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:346)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:152)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:107)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:137)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:214)
org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
root cause
java.lang.IllegalStateException: Duplicate component ID '_id20' found in view.
com.sun.faces.application.StateManagerImpl.checkIdUniqueness(StateManagerImpl.java:201)
com.sun.faces.application.StateManagerImpl.checkIdUniqueness(StateManagerImpl.java:204)
com.sun.faces.application.StateManagerImpl.saveSerializedView(StateManagerImpl.java:97)
com.sun.faces.taglib.jsf_core.ViewTag.doAfterBody(ViewTag.java:189)
org.apache.jsp.view_005fneed_jsp._jspx_meth_f_005fview_005f0(view_005fneed_jsp.java:741)
org.apache.jsp.view_005fneed_jsp._jspService(view_005fneed_jsp.java:546)
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:346)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:152)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:107)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:137)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:214)
org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
我有一个自定义组件,它仅在 DataTable 内呈现 HTML 以及 ah:form(也在数据表内)。
我的 bean 是请求级别 Bean,JSF 版本是实现版本:1.1_02-b08
[编辑] 我的自定义组件位于数据表内,我认为这造成了问题, 页面中也没有 Ajax 操作。
我的 jsp 看起来像这样..
<h:datatable>
<h:column>
<ch:activity name="#{need.name}" />
</h:column>
其中 CH:activity 是自定义组件
I am getting the following error when i try to return to same page without redirect.
org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: java.lang.IllegalStateException: Duplicate component ID '_id20' found in view.
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:527)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:401)
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:346)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:152)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:107)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:137)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:214)
org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
root cause
javax.servlet.ServletException: javax.servlet.jsp.JspException: java.lang.IllegalStateException: Duplicate component ID '_id20' found in view.
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
org.apache.jsp.view_005fneed_jsp._jspService(view_005fneed_jsp.java:556)
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:346)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:152)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:107)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:137)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:214)
org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
root cause
java.lang.IllegalStateException: Duplicate component ID '_id20' found in view.
com.sun.faces.application.StateManagerImpl.checkIdUniqueness(StateManagerImpl.java:201)
com.sun.faces.application.StateManagerImpl.checkIdUniqueness(StateManagerImpl.java:204)
com.sun.faces.application.StateManagerImpl.saveSerializedView(StateManagerImpl.java:97)
com.sun.faces.taglib.jsf_core.ViewTag.doAfterBody(ViewTag.java:189)
org.apache.jsp.view_005fneed_jsp._jspx_meth_f_005fview_005f0(view_005fneed_jsp.java:741)
org.apache.jsp.view_005fneed_jsp._jspService(view_005fneed_jsp.java:546)
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:346)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:152)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:107)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:137)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:214)
org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
I am having a custom component which just renders HTML inside the DataTable along with a h:form(also inside the datatable).
My bean is Request level Bean and the JSF version is Implementation-Version: 1.1_02-b08
[EDIT] My custom component is inside a Datatable I think thats creating the problem,
Also there is no Ajax action in the page.
My jsp looks like this..
<h:datatable>
<h:column>
<ch:activity name="#{need.name}" />
</h:column>
Where CH:activity is a custom component
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这些
_idxx
id 已生成,并且您的自定义组件中可能存在一些错误。您通常应该为每个组件提供一个自定义 ID,否则 AJAX 函数可能无法正常工作 - 如果您使用它们。您能发布您的 JSP/XHTML 吗?
你能检查一下你的渲染器(它是一个自定义的,对吗?)不会渲染相同的 id 两次?
Those
_idxx
ids are generated and maybe there's some error in your custom component. You should generally give each component a custom id, since otherwise AJAX functions might not work correctly - should you use them.Could you post your JSP/XHTML?
Can you check that your renderer (its a custom one, right?) doesn't render the same id twice?