0

Glassfish me genera este error

StandardWrapperValve[Faces Servlet]: Servlet.service() for servlet Faces Servlet threw exception java.lang.IllegalStateException: El ID del componente formulario8:precioProducto ya se ha encontrado en la vista.
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:951)
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:935)
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:935)
at com.sun.faces.application.view.FaceletPartialStateManagementStrategy.saveView(FaceletPartialStateManagementStrategy.java:461)
at com.sun.faces.application.StateManagerImpl.saveView(StateManagerImpl.java:89)
at com.sun.faces.application.view.WriteBehindStateWriter.flushToWriter(WriteBehindStateWriter.java:225)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:460)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544) at java.lang.Thread.run(Thread.java:745)

Esta es mi vista:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:jsf="http://xmlns.jcp.org/jsf">

    <body>

        <ui:composition template="./plantillaCliente.xhtml">

            <ui:define name="links">
                <link rel='stylesheet' href='../RecursosModulos/css/datatables/bootstrap.datatables.css'></link>
                <link rel='stylesheet' href='../RecursosModulos/css/datatables/jquery.dataTables.css'></link>  
                <link rel="stylesheet" href="../RecursosModulos/css/sweetalert2.css"></link>
                <script src="../RecursosModulos/js/sweetalert2.min.js"></script>

                <script type="text/javascript">
                    function myFunction1(cal, idform) {
                        x = cal.name;
                        document.getElementById("calificar" + idform + ":demo").value = x;

                    }

                    function deshabilitarBotonCalificar(pal) {
                        document.getElementById("calificar" + pal).disabled = "true";
                    }

                    function Calcular(temp, palabra) {
                        pcantidad = temp.value;
                        pvalor = document.getElementById("formulario" + palabra + ":precioProducto").value;
                        document.getElementById('precioPedido' + palabra).value = (pcantidad * pvalor);
                    }

                </script>
            </ui:define>
            <ui:define name="tituloPag">
                <title>Mis pedidos | Effective Orders</title>
            </ui:define>

si me pudieran ayudar lo agradecería mucho.

1 respuesta 1

1

El problema sucede porque tienes dos componentes JSF <h:componente> con el mismo ID dentro del mismo formulario <h:form>. Asegúrate de que tus componentes posean IDs diferentes y de que cuando los generes mediante <c:forEach> utilices alguna variable para cambiar el nombre de los componentes, o mejor aún: no utilices <c:forEach> en su lugar utiliza <ui:repeat>.

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.