Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/83.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
Html JSP标记库中没有结束标记_Html_Jsp_Tags - Fatal编程技术网

Html JSP标记库中没有结束标记

Html JSP标记库中没有结束标记,html,jsp,tags,Html,Jsp,Tags,出于某种原因,JSP编译器抱怨没有嵌套输入type=“checkbox”的的结束标记……我可以知道我做错了什么吗?我试着使用,但它也不起作用,编译器也抱怨没有结束标记 编辑:如果我没有像下面那样嵌套输入类型和设置变量,那么它可以工作……但是它无法完成我的原始逻辑 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <td colspan="1" width="100"> <c:choose&

出于某种原因,JSP编译器抱怨没有嵌套输入type=“checkbox”的
的结束标记……我可以知道我做错了什么吗?我试着使用
,但它也不起作用,编译器也抱怨没有结束标记

编辑:如果我没有像下面那样嵌套输入类型和设置变量,那么它可以工作……但是它无法完成我的原始逻辑

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<td colspan="1" width="100">
<c:choose>
  <c:when>
    <c:choose>
       <c:when></c:when><c:otherwise>
    <c:when test="<%=\"F\".equals(result[1]) %>">
     <c:set var="checked"><%=result[0].equals("Y")%></c:set>
     <input type="checkbox" id="<%="ABC"+"$"+rows%>" name="<%="ABC"+"$"+rows%>" value="<%=String.valueOf(rows)%>" ${checked ? 'checked' : ''} onclick="someFunction(this)"/>
    </c:when></c:otherwise>
    </c:choose>
  </c:when>    
  <c:otherwise>
  </c:otherwise>
</c:choose>
</td>


编辑2:我必须按照我的架构师lol的死亡之痛的方式来编写jsp。任何建议都将被欣然接受,以保留我提出的逻辑。

只需去掉所有那些scriptlet(老式的
东西)。它们与taglibs不好混合。JSTL属性只接受EL表达式

例如,假设您事先已经完成了
request.setAttribute(“results”,results)
,从技术上讲,这需要在servlet中完成,但也可以在JSP顶部的某个scriptlet中完成

    <c:otherwise>
            <c:when test="<%=\"F\".equals(result[1]) %>">
            </c:when>
            <c:set var="checked"><%=result[0].equals("Y")%></c:set>
             <input type="checkbox" id="<%="ABC"+"$"+rows%>" name="<%="ABC"+"$"+rows%>" value="<%=String.valueOf(rows)%>" ${checked ? 'checked' : ''} onclick="someFunction(this)"/>
    </c:otherwise>

...
${result[0]=='Y'}
...
通过这种方式,它的可读性也会大大提高

另见:

为什么要混合使用两种完全不同的JSP编写方法?使用taglibs/EL或oldschool scriptlets,不要两者都使用。我必须以这种方式编写jsp,因为我的架构师lol会给我带来死亡之痛。另外,因为系统就是这样设置的,可以查询数据库的。任何建议都会被欣然接受,以保留我提出的逻辑。
<c:forEach items="${results}" var="result">
  ...
  <td colspan="1" width="100">
    <c:choose>
      <c:when>
        <c:choose>
          <c:when></c:when>
          <c:otherwise>
            <c:when test="${result[1] == 'F'}">
              <c:set var="checked">${result[0] == 'Y'}</c:set>
              <input type="checkbox" id="ABC$${rows}" name="ABC$${rows}" value="${rows}" ${checked ? 'checked' : ''} onclick="someFunction(this)" />
            </c:when>
          </c:otherwise>
        </c:choose>
      </c:when>    
      <c:otherwise>
      </c:otherwise>
    </c:choose>
  </td>
  ...
</c:forEach>