JSP JSTL标签 Unterminated <c:when tag错误要疯了。?报错-问答-阿里云开发者社区-阿里云

开发者社区> 爱吃鱼的程序员> 正文

JSP JSTL标签 Unterminated <c:when tag错误要疯了。?报错

2020-06-07 16:46:53 226 1

使用JSP的JSTL标签,不知道什么原因导致forEach标签和choose标签无法检测到结束。

我能确定这两个标签都是正常结束的。

下面的forEach choose when标签逐个删除都报错。这样的写法,我用在了多个项目中,都没有出现这个问题,这次掉坑里了。完全不知道错在什么地方。

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/comm/jstl.jsp" %>
		<form class="form-horizontal form-bordered" role="form" method="post" action="${actionUrl}">
			<div class="form-group">
				<label for="txtBrandNo" class="col-sm-2 control-label no-padding-right">品牌</label>
				<div class="col-sm-10">
					<select name="brandId" class="form-control" id="selectBrandId" data-rule="required;">
						<option value="">请选择品牌</option>
						<c:forEach items="${brands}" var="brand">
							<c:choose>
								<c:when test="${brand.brandId==model.brandId}">
									<option value="${brand.brandId" selected>${brand.brandName}</option>
								</c:when>
								<c:otherwise>
									<option value="${brand.brandId">${brand.brandName}</option>
								</c:otherwise>
							</c:choose>
						</c:forEach>
					</select>
		        </div>
		        <span class="msg-box" for="selectBrandId"></span>
			</div>
		 	<div class="form-group">
		         <label for="txtBrandNo" class="col-sm-2 control-label no-padding-right">型号编号</label>
		         <div class="col-sm-10">
		             <input type="text" class="form-control" id="txtModelNo" placeholder="品牌编号" data-rule="required;" value="${model.modelNo}">
		         </div>
		         <span class="msg-box" for="txtModelNo"></span>
		     </div>
		     <div class="form-group">
		          <label for="txtBrandName" class="col-sm-2 control-label no-padding-right">型号名称</label>
		          <div class="col-sm-10">
		              <input type="text" class="form-control" id="txtModelName" placeholder="品牌名称" data-rule="required;" value="${model.modelName}">
		          </div>
		          <span class="msg-box" for="txtModelName"></span>
		      </div>
		      <div class="form-group">
		          <div class="col-sm-offset-2 col-sm-10">
		              <button type="submit" class="btn btn-palegreen">提交</button>
		          </div>
		      </div>
		</form>

错误日志:
 


2018-05-01 22:08:56 ERROR [http-bio-8080-exec-9] com.jfinal.core.ActionHandler  - /models/toDoAction
com.jfinal.render.RenderException: org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: org.apache.jasper.JasperException: /admin/product/modelForm.jsp (line: 42, column: 2) Unterminated <c:when tag
	at com.jfinal.render.JspRender.render(JspRender.java:69)
	at com.jfinal.core.ActionHandler.handle(ActionHandler.java:97)
	at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:72)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: org.apache.jasper.JasperException: /admin/product/modelForm.jsp (line: 42, column: 2) Unterminated <c:when tag
	at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:487)
	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:412)
	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:339)
	at com.jfinal.render.JspRender.render(JspRender.java:67)
	... 18 more
Caused by: javax.servlet.ServletException: javax.servlet.jsp.JspException: org.apache.jasper.JasperException: /admin/product/modelForm.jsp (line: 42, column: 2) Unterminated <c:when tag
	at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:908)
	at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:841)
	at org.apache.jsp.admin.product.modelAdd_jsp._jspService(modelAdd_jsp.java:144)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
	... 31 more
Caused by: org.apache.jasper.JasperException: /admin/product/modelForm.jsp (line: 42, column: 2) Unterminated <c:when tag
	at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42)
	at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:443)
	at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:133)
	at org.apache.jasper.compiler.Parser.parseBody(Parser.java:1677)
	at org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:1002)
	at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1274)
	at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1452)
	at org.apache.jasper.compiler.Parser.parseBody(Parser.java:1664)
	at org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:1002)
	at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1274)
	at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1452)
	at org.apache.jasper.compiler.Parser.parseBody(Parser.java:1664)
	at org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:1002)
	at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1274)
	at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1452)
	at org.apache.jasper.compiler.Parser.parse(Parser.java:138)
	at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:242)
	at org.apache.jasper.compiler.ParserController.parse(ParserController.java:102)
	at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
	at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
	at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:605)
	at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:544)
	at org.apache.taglibs.standard.tag.common.core.ImportSupport.acquireString(ImportSupport.java:314)
	at org.apache.taglibs.standard.tag.common.core.ImportSupport.doEndTag(ImportSupport.java:171)
	at org.apache.jsp.admin.product.modelAdd_jsp._jspx_meth_c_005fimport_005f2(modelAdd_jsp.java:334)
	at org.apache.jsp.admin.product.modelAdd_jsp._jspService(modelAdd_jsp.java:123)
	... 34 more

 

取消 提交回答
全部回答(1)
  • 爱吃鱼的程序员
    2020-06-07 16:47:08
                        otherwise|option|value  少了  } 
                    
    
                            确实少了个右大括号 
                        
    
                        天啊,居然还在用JSP 
                    
    
                            我个人觉得还是抛弃JSP这种在服务器上做html生成的方式,毕竟服务器资源有限,让服务器专注于业务逻辑处理。
                        
    
                            jsp性能好,你有不同意见吗?
                        
    
                        <div class='ref'><h4>引用来自“爱蔚兰真好”的评论</h4>otherwise|option|value  少了  } 
    
                            汗,确实不应该发生的错误。这个是编码习惯造成的。论好习惯的重要性。
                        
    
                        <div class='ref'><h4>引用来自“龙影”的评论</h4>天啊,居然还在用JSP 
    
                            <a target='_blank'>@CapJes</a> 回复<a class="referer" target="_blank">@CapJes</a> : 这就得要看领导是否有那协调能力了,前后端分离,其实对设计者要求会更高些。但是对于软件来说是好事。对应好接口来开发何尝不是件好事?so,先定义好合理的接口。
                        
    
                            <a target='_blank'>@CapJes</a> 回复<a class="referer" target="_blank">@CapJes</a> : 没说前后分离就必须分工到两种人。这个看前后端选型及搭配是否适合一个人同时做。反正我现在的方式一个人全包。因为简单,培训下组员,很快上手开发。
                        
    
                                回复 <a class="referer" target="_blank">@龙影</a>  : 一个人做前后全包了,去做前后分离,反而麻烦。
                        
    
                            回复<a class="referer" target="_blank">@CapJes</a> : 也不是说它不好,只是说要看如何使用。毕竟现在前端技术那么多可以选择。开发效率和综合性能方面来考量选择的。
    
    0 0
相关问答

40

回答

[@徐雷frank][¥20]什么是JAVA的平台无关性

大河人家 2018-10-29 23:55:20 144276浏览量 回答数 40

162

回答

惊喜翻倍:免费ECS+免费环境配置~!(ECS免费体验6个月活动3月31日结束)

豆妹 2014-10-29 17:52:21 223004浏览量 回答数 162

8

回答

OceanBase 使用动画(持续更新)

mq4096 2019-02-20 17:16:36 333879浏览量 回答数 8

13

回答

[@饭娱咖啡][¥20]我想知道 Java 关于引用那一块的知识

心意乱 2018-10-31 18:44:12 142137浏览量 回答数 13

110

回答

OSS存储服务-客户端工具

newegg11 2012-05-17 15:37:18 292294浏览量 回答数 110

22

回答

爬虫数据管理【问答合集】

我是管理员 2018-08-10 16:37:41 146786浏览量 回答数 22

18

回答

阿里云开放端口权限

xcxx 2016-07-20 15:03:33 643138浏览量 回答数 18

31

回答

[@倚贤][¥20]刚学完html/css/js的新手学习servlet、jsp需要注意哪些问题?

弗洛伊德6 2018-10-27 21:52:43 145626浏览量 回答数 31

42

回答

【精品问答集锦】Python热门问题

小六码奴 2019-05-30 15:27:34 135561浏览量 回答数 42

10

回答

[@墨玖tao][¥20]为什么流式处理框架都是 java 写成的,JVM 是不是在流和批存在着特殊优势。还有分布式资源调度,感觉Mesos 的成长速度跟不上 Yarn。这是为什么?

管理贝贝 2018-10-23 13:18:03 136129浏览量 回答数 10
+关注
爱吃鱼的程序员
https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB
2
文章
21569
问答
推荐问答
相关电子书
更多
文娱运维技术
立即下载
《SaaS模式云原生数据仓库应用场景实践》
立即下载
《看见新力量:二》电子书
立即下载