samira
samira

Reputation: 1295

Component ID j_id?:name has already been found in the view

i have error HTTP Status 500 in my project. i am using integration of jsf spring and hibernate. i have no idea to solve this problem. i have added the necessary jar files. the error is:

description The server encountered an internal error () that prevented it from fulfilling this request.
exception: javax.servlet.ServletException: Component ID j_idt4:name has already been found in the view.  
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:321)

the trace is:

</head>
<body>
<h1>اضافه کردن پرسنل جد?د</h1>

  +id: j_idt4
   type: javax.faces.component.html.HtmlForm@1810af25
    +id: j_idt5
     type: javax.faces.component.html.HtmlPanelGrid@cc4dacd
      +id: j_idt6
       type: 
              شماره پرسنل? : 

      +id: name
       type: javax.faces.component.html.HtmlInputText@6f5ab27a

personel.xhtml

<?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:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui"
>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>اطلاعات پرسنلی</title>
</head>
<body>
<h1>اضافه کردن پرسنل جدید</h1>
        <h:form>

            <h:panelGrid columns="6" dir="rtl">
              شماره پرسنلی : 
                <h:inputText id="name" value="#{personelMB.personel_id}" 
                    size="20" required="true"
                    label="id" >
                </h:inputText>
                نام : 
                <h:inputText id="name" value="#{personelMB.pname}" 
                    size="20" required="true"
                    label="Name" >
                </h:inputText>

                 نام خانوادگی: 
                <h:inputText id="family" value="#{personelMB.pfamily}" 
                    size="20" required="true"
                    label="family" >
                </h:inputText> 

                آدرس : 
                <h:inputTextarea id="address" value="#{personelMB.paddress}" 
                    cols="30" rows="10" required="true"
                    label="Address" >
                </h:inputTextarea>


          تلفن:  
                <h:inputText id="tel" value="#{personelMB.pphone}" 
                    size="20" required="true"
                    label="tel" >
                </h:inputText> 
            </h:panelGrid>

            <h:commandButton value="درج اطلاعات" action="#{personelMB.addPersonel()}" />

        </h:form>
</body>
</html>

please help me.

Upvotes: 3

Views: 11141

Answers (1)

mthmulders
mthmulders

Reputation: 9705

You have two occurences of <h:inputText with id="name". Those ids ought to be unique within the closest parent component that is a naming container, such as a data table component, or a form.

Upvotes: 7

Related Questions