Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么这个JSP片段会破坏我的html代码?_Html_Jsp_Tomcat_Spring Mvc_Jstl - Fatal编程技术网

为什么这个JSP片段会破坏我的html代码?

为什么这个JSP片段会破坏我的html代码?,html,jsp,tomcat,spring-mvc,jstl,Html,Jsp,Tomcat,Spring Mvc,Jstl,因此,我有一个jsp,它根据通过SpringMVC传递的变量提供提名视图和表单。现在,当用户想要填写新的提名时,该视图可以工作。当他们查看提名以供审核时(该提名被标记为禁用),它也可以工作,但审核人(在本例中称为通才)访问它时,它不起作用。它分解到这一点: 注意它开始显示html代码的位置。代码显示发生在IE中,但在其他浏览器上它还没有“中断”,因为它的侧面和底部缺少表单元素 这只发生在以下代码段中: <div align="center"> <c:if test="

因此,我有一个jsp,它根据通过SpringMVC传递的变量提供提名视图和表单。现在,当用户想要填写新的提名时,该视图可以工作。当他们查看提名以供审核时(该提名被标记为禁用),它也可以工作,但审核人(在本例中称为通才)访问它时,它不起作用。它分解到这一点:

注意它开始显示html代码的位置。代码显示发生在IE中,但在其他浏览器上它还没有“中断”,因为它的侧面和底部缺少表单元素

这只发生在以下代码段中:

<div align="center">
    <c:if test="${mode==cons.GENERALIST}">
        <spring:message code="common.status"/>: <br/>
        <select name="statusId">
            <c:forEach items="${statusList}" var="status">
                <option value="${status.id}" <c:if
                        test="${status.id==currentStatusId}"> selected="selected"</c:if> >
                    <c:if test="${lang=='es'}">${status.statusSpanish}</c:if>
                    <c:if test="${lang=='en'}">${status.statusEnglish}</c:if>
                </option>
            </c:forEach>
        </select>
        <br/>
        <br/>

        <spring:message code="common.comments"/>:<br/>
        <textarea name="generalistComment" cols="50" rows="5">${currentGeneralistComment}</textarea>
        <br/>
        <br/>
        <spring:message code="common.committeeScore"/>:<br/>
        <input type="text" name="committeeScore" value="${nomination.commiteeScore}"/>
    </c:if>
</div>

那么到底是什么在破坏我的html呢?我知道这是代码片段,但我一直在寻找未关闭的标签,但毫无结果

在开始转储HTML的屏幕截图中,似乎有一个未关闭的报价
被禁用=“已禁用
。根据发布的jsp源代码,它看起来应该被正确关闭,所以它可能只是在屏幕截图中丢失了。您是否通过在浏览器中查看页面源代码来验证生成的代码是否正确?jsp代码中有双引号。源代码也在同一个位置截断,所以我不知道。我将开始将HTML输出提供给validator.w3.org。它会给你一个所有HTML验证错误的列表,包括损坏的标记和丢失的标记。我已经做了很多次了,我得到的唯一验证错误是因为标记没有因为源被“损坏”而结束。我真的认为tomcat服务器解析有问题吗?或者类似的问题?
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<jsp:useBean id="cons" class="com.project.lmu.util.NominationMode" scope="application"/>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<script type="text/javascript">
    $(function() {
        $('.datepicker').datepicker({
            changeMonth: true,
            changeYear:  true,
            minDate:     "-50Y",
            maxDate:    new Date(),
            yearRange:  "-50",
            showOn: "button",
            buttonImage: "images/prototipo/calendar1.png",
            buttonImageOnly: true
        });
    });
</script>

<td id="content_inner">
<div id="content">

<h1><spring:message code="successNomination.lable.title"/></h1>
<br/>

<c:if test="${error==true}">

    <div class="error">
        <ul>
            <c:forEach items="${nomination.errors}" var="message">
                <li><spring:message code="${message}"/></li>
            </c:forEach>
        </ul>
    </div>
</c:if>

<form name="f" action="successSaveNomination" method="post">

<c:if test="${nomination.nominationId==null}">
    <input type="hidden" name="nominationId" value="0"/>
</c:if>
<c:if test="${nomination.nominationId!=null}">
    <input type="hidden" name="nominationId" value="${nomination.nominationId}"/>
</c:if>

<input type="hidden" name="nomineeId" value="${nominee.id}"/>
<input type="hidden" name="mode" value="${mode}"/>

<table border="0" cellpadding="0" cellspacing="5" width="100%">
    <tr>
        <td valign="top" width="150px"><b><spring:message code="successNomination.lable.subtitle1"/>: </b></td>
        <td>
            <table border="0" cellpadding="0" cellspacing="0" width="100%">
                <tr>
                    <td>${nominee.firstName} ${nominee.middleName} ${nominee.lastName}</td>
                </tr>
                <tr>
                    <td><i>${nominee.jobTitle} - ${nominee.department.description} - ${nominee.id}</i></td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td><b><spring:message code="successNomination.lable.subtitle4"/>: </b></td>
        <td>
            <select name="periodId"
                    <c:if test="${mode==cons.READ_ONLY||mode==cons.GENERALIST}">disabled="disabled" </c:if> >
                <c:forEach items="${periods}" var="period">
                    <option value="${period.id}"
                            <c:if test="${period.id==nomination.periodId}">selected="selected"</c:if>>&nbsp; &nbsp;
                        &nbsp; &nbsp;${period.periodDescription}</option>
                </c:forEach>
            </select>
        </td>
    </tr>
</table>

<br/>

<table width="100%">
<tr>
    <th class="green"><spring:message code="successNomination.label.requirements.title1"/></th>
    <th width="50%" class="green"><spring:message code="successNomination.label.requirements.title2"/></th>
</tr>
<tr>
    <td class="gborder" valign="middle">
        <p><spring:message code="successNomination.label.requirements1"/></p>

        <p>
            <spring:message code="successNomination.label.requirements2"/>:
            <input type="text" class="points" disabled="disabled"
                   value="<fmt:formatDate type='date' pattern='MM/dd/yyyy' value='${nominee.hireDate}' />"/>
        </p>
    </td>
    <td class="gborder">
        <p class="centered">
            <textarea cols="40" rows="6" name="hireComments" <c:if
                    test="${mode==cons.READ_ONLY||mode==cons.GENERALIST}"> disabled="disabled" </c:if>>${nomination.hireComments}</textarea>
        </p>
    </td>
</tr>
<tr>
    <td class="gborder"><p><spring:message code="successNomination.label.requirements3"/><br/>
        <a href="#footnote" class="required"><spring:message code="successNomination.lable.instructions1"/> </a></p>

        <table>
            <tr style="padding:3em;">
                <td><spring:message code="successNomination.label.requirements4"/>:</td>
                <td><input type="text" class="points" name="evaluationPoints1"
                           value="${nomination.evaluationPoints1}"
                           <c:if test="${mode==cons.READ_ONLY||mode==cons.GENERALIST}">disabled="disabled"</c:if> />
                </td>
                <td><spring:message code="successNomination.label.requirements5"/>:</td>
                <td><input type="text" class="points datepicker" name="evaluationYear1"
                           value="${nomination.evaluationYear1}"
                           <c:if test="${mode==cons.READ_ONLY||mode==cons.GENERALIST}">disabled="disabled"</c:if>
                           readonly="readonly"/>
                </td>

            </tr>
            <tr>
                <td><spring:message code="successNomination.label.requirements4"/>:</td>
                <td><input type="text" class="points" name="evaluationPoints2"
                           value="${nomination.evaluationPoints2}"
                           <c:if test="${mode==cons.READ_ONLY||mode==cons.GENERALIST}">disabled="disabled"</c:if> />
                </td>
                <td><spring:message code="successNomination.label.requirements5"/>:</td>
                <td><input type="text" class="points datepicker" name="evaluationYear2"
                           value="${nomination.evaluationYear2}"
                           <c:if test="${mode==cons.READ_ONLY||mode==cons.GENERALIST}">disabled="disabled"</c:if>
                           readonly="readonly"/>
                </td>
            </tr>
        </table>
    </td>
    <td class="gborder">
        <p class="centered">
            <textarea cols="40" rows="6" name="evaluationComments"
                    <c:if test="${mode==cons.READ_ONLY||mode==cons.GENERALIST}"> disabled="disabled" </c:if>>${nomination.evaluationComments}</textarea>
        </p>
    </td>
</tr>
<tr>
    <td class="gborder"><p><spring:message code="successNomination.label.requirements6"/></p>

        <table>
            <tr>
                <td><spring:message code="successNomination.label.requirements7"/>:</td>
                <td>
                    <input type="text" class="points datepicker" name="promotionDate1"
                           <c:if test="${nomination.promotionDate1 != null}">value="${nomination.promotionDate1}"</c:if>
                           <c:if test="${mode==cons.READ_ONLY||mode==cons.GENERALIST}">disabled="disabled"</c:if>
                           readonly="readonly"/>
                </td>
            </tr>
            <tr>
                <td><spring:message code="successNomination.label.requirements7"/>:</td>
                <td>
                    <input type="text" class="points datepicker" name="promotionDate2"
                           <c:if test="${nomination.promotionDate2 != null}">value="${nomination.promotionDate2}"</c:if>
                           <c:if test="${mode==cons.READ_ONLY||mode==cons.GENERALIST}">disabled="disabled"</c:if>
                           readonly="readonly"/>
                </td>
            </tr>
            <tr>
                <td><spring:message code="successNomination.label.requirements7"/>:</td>
                <td>
                    <input type="text" class="points datepicker" name="promotionDate3"
                           <c:if test="${nomination.promotionDate3 != null}">value="${nomination.promotionDate3}"</c:if>
                           <c:if test="${mode==cons.READ_ONLY||mode==cons.GENERALIST}">disabled="disabled"</c:if>
                           readonly="readonly"/>
                </td>
            </tr>
            <tr>
                <td><spring:message code="successNomination.label.requirements7"/>:</td>
                <td>
                    <input type="text" class="points datepicker" name="promotionDate4"
                           <c:if test="${nomination.promotionDate4 != null}">value="${nomination.promotionDate4}"</c:if>
                           <c:if test="${mode==cons.READ_ONLY||mode==cons.GENERALIST}">disabled="disabled"</c:if>
                           readonly="readonly"/>
                </td>
            </tr>
        </table>
    </td>
    <td class="gborder">
        <p class="centered">
            <textarea cols="40" rows="6" name="promotionComments"
                    <c:if test="${mode==cons.READ_ONLY||mode==cons.GENERALIST}"> disabled="disabled" </c:if>>${nomination.promotionComments}</textarea>
        </p>
    </td>
</tr>
<tr>
    <td class="gborder">
        <p>
            <spring:message code="successNomination.label.requirements8"/><br/>
            <a href="#footnote" class="required"><spring:message code="successNomination.lable.instructions1"/></a>
        </p>

        <p>

            <input type="radio" name="extraContribution" value="1"
                   <c:if test="${nomination.extraContribution == true}">checked="checked"</c:if>
                   <c:if test="${mode==cons.READ_ONLY||mode==cons.GENERALIST}">disabled="disabled"</c:if>
                   onclick="activateContributionsField(document.f)"/>
            <spring:message code="successNomination.label.requirements9"/> &nbsp;
            <input type="radio" name="extraContribution" value="0"
                   <c:if test="${nomination.extraContribution == false}">checked="checked"</c:if>
                   <c:if test="${mode==cons.READ_ONLY||mode==cons.GENERALIST}">disabled="disabled"</c:if>
                   onclick="activateContributionsField(document.f)"/>
            <spring:message code="successNomination.label.requirements10"/><br/>
            <spring:message code="successNomination.label.requirements11"/>:
            <input type="text" class="points" name="extraContributionPoints"
                   value="${nomination.extraContributionPoints}"
                   <c:if test="${mode==cons.READ_ONLY||mode==cons.GENERALIST || nomination.extraContribution!=true}">disabled="disabled"</c:if> />
        </p>
    </td>
    <td class="gborder">
        <p class="centered">
            <textarea cols="40" rows="6" name="extraComments"
                    <c:if test="${mode==cons.READ_ONLY||mode==cons.GENERALIST}"> disabled="disabled" </c:if>>${nomination.extraComments}</textarea>
        </p>
    </td>
</tr>
<tr>
    <td class="gborder">
        <p><spring:message code="successNomination.label.requirements12"/><br/>
            <a href="#footnote" class="required"><spring:message code="successNomination.lable.instructions1"/></a>
        </p>

        <p>
            <input type="radio" name="companyPolicy" value="1"
                   <c:if test="${nomination.companyPolicy == true}">checked="checked"</c:if>
                   <c:if test="${mode==cons.READ_ONLY||mode==cons.GENERALIST}">disabled="disabled"</c:if> />
            <spring:message code="successNomination.label.requirements9"/> &nbsp;
            <input type="radio" name="companyPolicy" value="0"
                   <c:if test="${nomination.companyPolicy == false}">checked="checked"</c:if>
                   <c:if test="${mode==cons.READ_ONLY||mode==cons.GENERALIST}">disabled="disabled"</c:if> />
            <spring:message code="successNomination.label.requirements10"/>
        </p>
    </td>
    <td class="gborder">
        <p class="centered">
            <textarea cols="40" rows="6" name="companyPolicyComments"
                    <c:if test="${mode==cons.READ_ONLY||mode==cons.GENERALIST}"> disabled="disabled" </c:if>>${nomination.companyPolicyComments}</textarea>
        </p>
    </td>
</tr>
<tr>
    <td class="gborder">
        <p>
            <spring:message code="successNomination.label.requirements13"/><br/>
            <a href="#footnote" class="required"><spring:message code="successNomination.lable.instructions1"/></a>
        </p>

        <p>
            <spring:message code="successNomination.label.requirements14"/>:
            <input type="radio" value="1" name="evaluationAttendancePolicy1"
                   <c:if test="${nomination.evaluationAttendancePolicy1 == true}">checked="checked"</c:if>
                   <c:if test="${mode==cons.READ_ONLY||mode==cons.GENERALIST}">disabled="disabled"</c:if> />
            <spring:message code="successNomination.label.requirements9"/>
            <input type="radio" value="0" name="evaluationAttendancePolicy1"
                   <c:if test="${nomination.evaluationAttendancePolicy1 == false}">checked="checked"</c:if>
                   <c:if test="${mode==cons.READ_ONLY||mode==cons.GENERALIST}">disabled="disabled"</c:if> />
            <spring:message code="successNomination.label.requirements10"/>
        </p>

        <p>
            <spring:message code="successNomination.label.requirements15"/>:
            <input type="radio" value="1" name="evaluationAttendancePolicy2"
                   <c:if test="${nomination.evaluationAttendancePolicy2 == true}">checked="checked"</c:if>
                   <c:if test="${mode==cons.READ_ONLY||mode==cons.GENERALIST}">disabled="disabled"</c:if> />
            <spring:message code="successNomination.label.requirements9"/>
            <input type="radio" value="0" name="evaluationAttendancePolicy2"
                   <c:if test="${nomination.evaluationAttendancePolicy2 == false}">checked="checked"</c:if>
                   <c:if test="${mode==cons.READ_ONLY||mode==cons.GENERALIST}">disabled="disabled"</c:if> />
            <spring:message code="successNomination.label.requirements10"/>
        </p>
    </td>
    <td class="gborder">
        <p class="centered">
            <textarea cols="40" rows="6" name="attendanceComments"
                    <c:if test="${mode==cons.READ_ONLY||mode==cons.GENERALIST}"> disabled="disabled" </c:if>>${nomination.attendanceComments}</textarea>
        </p>
    </td>
</tr>
</table>

<br/>

<p>
    <spring:message code="successNomination.label.requirements16"/>:
</p>

<div align="center">
    <textarea cols="50" rows="7" name="reason" <c:if
            test="${mode==cons.READ_ONLY||mode==cons.GENERALIST}"> disabled="disabled" </c:if> >${nomination.reason}</textarea>
</div>
<br/>

<div align="center">
    <c:if test="${mode==cons.GENERALIST}">
        <spring:message code="common.status"/>: <br/>
        <select name="statusId">
            <c:forEach items="${statusList}" var="status">
                <option value="${status.id}" <c:if
                        test="${status.id==currentStatusId}"> selected="selected"</c:if> >
                    <c:if test="${lang=='es'}">${status.statusSpanish}</c:if>
                    <c:if test="${lang=='en'}">${status.statusEnglish}</c:if>
                </option>
            </c:forEach>
        </select>
        <br/>
        <br/>

        <spring:message code="common.comments"/>:<br/>
        <textarea name="generalistComment" cols="50" rows="5">${currentGeneralistComment}</textarea>
        <br/>
        <br/>
        <spring:message code="common.committeeScore"/>:<br/>
        <input type="text" name="committeeScore" value="${nomination.commiteeScore}"/>
    </c:if>
</div>


<div id="bottommenu">
    <c:if test="${(mode==cons.NEW||mode==cons.EDIT)}">
        <input type="submit" value="<spring:message code="common.send"/>"/>
    </c:if>
    <c:if test="${mode==cons.GENERALIST}">
        <input type="button" value="<spring:message code="common.save"/>" onclick="generalistSuccessUpdate()"/>
    </c:if>
    <c:if test="${mode==cons.NEW}">
        <input type="reset" value="<spring:message code="common.reset"/>">
    </c:if>
    <c:if test="${mode==cons.EDIT}">
        <script type="text/javascript">var msg = "<spring:message code='nominations.confirm' javaScriptEscape='true' />";</script>
        <input type="button" value="<spring:message code="common.delete"/>" onclick="delNomination()"/>
    </c:if>
    <c:if test="${mode==cons.READ_ONLY||mode==cons.EDIT||mode==cons.GENERALIST}">
        <input type="button" value="<spring:message code="common.print"/>" onclick="printNomination()"/>
        <input type="button" value="<spring:message code="common.back"/>" onclick="history.back();"/>
    </c:if>
</div>

<div id="footnote">
    <p> * <spring:message code="successNomination.lable.instructions3"/>.<br/>
        **<spring:message code="successNomination.lable.instructions4"/>.</p>
</div>

</form>

<form name="d" action="successDeleteNomination" method="post">
    <input type="hidden" name="nominationId" value="${nomination.nominationId}"/>
</form>

<form name="p" action="successPrint" method="post">
    <input type="hidden" name="nominationId" value="${nomination.nominationId}"/>
</form>

<form name="g" action="successGenUpdate" method="post">
    <input type="hidden" name="nominationId" value="${nomination.nominationId}"/>
    <input type="hidden" name="statusId" value="${statusId}"/>
    <input type="hidden" name="generalistComment" value="${generalistComment}"/>
</form>

</div>
</td>