例外:Grails标签[g:applyLayout]未关闭

时间:2013-10-30 10:03:26

标签: grails gsp

我不知道为什么会这样。我有一个名为_showcontacts.gsp的模板。来源如下:

 <content tag="column1"> 
 <div class="form-edit">
    <div class="heading">
        <strong>
            <g:message code="Contact Details of the firm:"/>${name}
        </strong>
    </div>

     <div id="hai" class="form-hold">
        <form name="company-edit-form" action="save">
            <fieldset>
                <div class="form-columns">


                    <div class="column" >
                          <g:applyLayout name="form/input">
                            <content tag="label"><g:message code="Company Name"/></content>
                            <content tag="label.for">Company</content>
                            <g:textField class="field" name="Company"  id="Company"  />
                        </g:applyLayout>
                          <content> 
                            <content tag="label"><g:message code="First Name"/>

                             <textField class="field" name="firstName"  id="Company">
                              <label for="txt1"></label>
                              <input type="text" name="txt1" id="txt1" value="${contact.firstName}">
                            </textField>
                            <br>

                            <g:message code="Group"/>

                             <textField class="field" name="group"  id="Company">
                              <label for="txt2"></label>
                              <input type="text" name="txt2" id="txt2" value="${contact.group}">
                            </textField>

                            <br>

                            <g:message code="ID"/>

                             <textField class="field" name="id"  id="Company">
                              <label for="txt3"></label>
                              <input type="text" name="txt3" id="txt3" value="${contact.id}">
                            </textField>
                            <br>


                            <g:message code="Last Name"/>

                             <textField class="field" name="lastName"  id="Company">
                              <label for="txt4"></label>
                              <input type="text" name="txt4" id="txt4" value="${contact.lastName}">
                            </textField>

                            <br>

                            <g:message code="Title"/>

                             <textField class="field" name="title"  id="Company">
                              <label for="txt5"></label>
                              <input type="text" name="txt5" id="txt5" value="${contact.title}">
                            </textField>

                          </content>
                       </content>     
          </div>
         </div> 
        </fieldset>
       </form> 
     </div>
   </div>
 </content>

执行时,显示

Grails标签[g:applyLayout]未关闭

我已经多次重新检查了。但我的标签已正确关闭。我该怎么做才能正确渲染此模板?我也尝试将此模板转换为视图。但同样的错误。我让这个applyLayout在另一个模板中正常工作我从那里复制了它。不知道为什么它不在这里工作。 编辑:正在运行的完整gsp代码: list.gsp //查看呈现其他模板

<head>
<meta name="layout" content="panels" />

</head>
<body>

 %{--show all user's details--}%
 <sec:ifAllGranted roles="MENU_90">
 <content tag="column1">
    <g:render template="customers" model="[users: users,results:results]"/>
 </content>


 </sec:ifAllGranted>

</body>
</html>

_Customers.gsp // applyLayout工作正常的模板

 <script type="text/javascript">
   function asd(tdcId, companyId, companyType,companyName) {
 alert(companyName);
 var link = "${g.createLink(controller: 'customer', action: 'showcontacts')}?tdc=" + tdcId + "&companyid=" + companyId + "&companytype=" + companyType+ "&companyname=" + companyName;
   window.open(link, '', 'width=200,height=100');
}

</script>

<div class="form-edit">
    <div class="heading">
        <strong>
            <g:message code="Firm Profile"/>
        </strong>
    </div>

    <div id="hai" class="form-hold">
        <g:form name="company-edit-form" action="save">
            <fieldset>
                <div class="form-columns">


                    <div class="column">
                        <g:applyLayout name="form/input">
                            <content tag="label"><g:message code="Company Name"/</content>
                            <content tag="label.for">Company</content>
                            <g:textField class="field" name="Company"  id="Company"  />
                        </g:applyLayout>
                         <g:applyLayout name="form/checkbox">
                             <content tag="label"><g:message code="Starts with"/</content>
                             <content tag="label.for">Starts with</content>
                             <g:checkBox class="cb checkbox" name="StartsWith" />
                        </g:applyLayout>
                        <g:applyLayout name="form/input">
                            <content tag="label"><g:message code="Street"/></content>
                            <content tag="label.for">Street</content>
                            <g:textField class="field" name="Street" />
                        </g:applyLayout>

                         <g:applyLayout name="form/checkbox">
                             <content tag="label"><g:message code="Starts with"/</content>
                             <content tag="label.for">Starts With</content>
                             <g:checkBox class="cb checkbox" name="StreetStartsWith"/>
                        </g:applyLayout>
                        <g:applyLayout name="form/input">
                            <content tag="label"><g:message code="Zip code"/></content>
                            <content tag="label.for">Zip</content>
                            <g:textField class="field" name="ZipCode"/>
                        </g:applyLayout>

                        <g:applyLayout name="form/input">
                            <content tag="label"><g:message code="Fagrubrik"/</content>
                            <content tag="label.for">Fagrubrik</content>
                            <g:textField class="field" name="Fagrubrik" />
                        </g:applyLayout>

                        <g:applyLayout name="form/input">
                            <content tag="label"><g:message code="House no."/</content>
                            <content tag="label.for">HouseNo</content>
                            <g:textField class="field" name="HouseNo" />
                        </g:applyLayout>

                        <g:applyLayout name="form/input">
                            <content tag="label"><g:message code="Tel./Fax."/</content>
                            <content tag="label.for">Telephone</content>
                            <g:textField class="field" name="Telephone" />
                        </g:applyLayout>

                        <g:applyLayout name="form/input">
                            <content tag="label"><g:message code="Company No."/</content>
                            <content tag="label.for">CompanyNo</content>
                            <g:textField class="field" name="CompanyNo" />
                        </g:applyLayout>

                        <g:applyLayout name="form/input">
                            <content tag="label"><g:message code="City"/></content>
                            <content tag="label.for">City</content>
                            <g:textField class="field" name="City" />
                             </g:applyLayout>

                        <g:applyLayout name="form/input">
                            <content tag="label"><g:message code="TDC ID"/></content>
                            <content tag="label.for">TdcId</content>
                            <g:textField class="field" name="TdcId" />
                             </g:applyLayout>

                             <g:applyLayout name="form/input">
                            <content tag="label"><g:message code="Industry Designation"/></content>
                            <content tag="label.for">Industry Designation</content>
                            <g:textField class="field" name="IndustryDesignation" />
                             </g:applyLayout>

                             <g:applyLayout name="form/input">
                            <content tag="label"><g:message code="Decision Maker"/</content>
                            <content tag="label.for">DecisionMaker</content>
                            <g:textField class="field" name="DecisionMaker" />
                             </g:applyLayout>

                             <g:applyLayout name="form/input">
                            <content tag="label"><g:message code="Email"/></content>
                            <content tag="label.for">Email</content>
                            <g:textField class="field" name="Email" />
                             </g:applyLayout>

                             <g:applyLayout name="form/input">
                            <content tag="label"><g:message code="WWW"/></content>
                            <content tag="label.for">WWW</content>
                            <g:textField class="field" name="WWW"/>
                             </g:applyLayout>


                    </div>

                </div>


                <div>
                    <br/>&nbsp;
                </div>



            </fieldset>
            <div id="button" class="buttons">
                    <ul>
                        <li>
                        <g:submitButton  id="button" class="buttons" name="Search" value="Search" action="search" style= "background-color:#191DD4 text-color:#FFFFFF"/>
                          </li>
                        </ul>
                        </div>

        </g:form>
           <div class="table-box">
           <g:if test="${company}">
<table cellpadding="0" cellspacing="0">
<thead>
    <tr>
        <th class="small"><g:message code="Company Name"/></th>
        <th class="medium"><g:message code="TDCID"/></th>
        <th class="tiny"><g:message code="STREET"/></th>
    </tr>
</thead>
<tbody>
    <g:each in="${company}" status="idx" var="PNo">

       <tr>
         <td>
         <a href="javascript:void(0)" onClick="javascript:asd('${PNo.tdcId}', '${PNo.companyId}', '${PNo.companyType}', '${PNo.officialName}');">${PNo.officialName}</a>


         </td>
         <td>
         <g:remoteLink action="show" id="${PNo}" before="register(this);" 
                       onSuccess="render(data, next);" params="[template:'show']">
             ${PNo.tdcId}
         </g:remoteLink>
         </td>
         <td>

              ${PNo.street}

         </td>
       </tr>

        </g:each>
     </tbody>
  </table>     
</g:if>
</div>


   

1 个答案:

答案 0 :(得分:0)

我不是HTML专家,我只是做了修改,它对我有用。

<div class="form-edit">
<div class="heading">
    <strong>
        <g:message code="Contact Details of the firm:"/>${name}
    </strong>
</div>

<div id="hai" class="form-hold">
    <form name="company-edit-form" action="save">
        <fieldset>
            <div class="form-columns">

                <div class="column">
                    <g:applyLayout name="form/input">
                        <content tag="label"><g:message code="Company Name"/></content>
                        <content tag="label.for">Company</content>
                        <g:textField class="field" name="Company" id="Company"/>
                    </g:applyLayout>
                    <content tag="label"><g:message code="First Name"/>

                        <textField class="field" name="firstName" id="Company">
                            <label for="txt1"></label>
                            <input type="text" name="txt1" id="txt1" value="${contact?.firstName}">
                        </textField>
                        <br>

                        <g:message code="Group"/>

                        <textField class="field" name="group" id="Company">
                            <label for="txt2"></label>
                            <input type="text" name="txt2" id="txt2" value="${contact?.group}">
                        </textField>

                        <br>

                        <g:message code="ID"/>

                        <textField class="field" name="id" id="Company">
                            <label for="txt3"></label>
                            <input type="text" name="txt3" id="txt3" value="${contact?.id}">
                        </textField>
                        <br>


                        <g:message code="Last Name"/>

                        <textField class="field" name="lastName" id="Company">
                            <label for="txt4"></label>
                            <input type="text" name="txt4" id="txt4" value="${contact?.lastName}">
                        </textField>

                        <br>

                        <g:message code="Title"/>

                        <textField class="field" name="title" id="Company">
                            <label for="txt5"></label>
                            <input type="text" name="txt5" id="txt5" value="${contact?.title}">
                        </textField>

                    </content>
                </div>
            </div>
        </fieldset>
    </form>
</div>