javaweb报错问题以及解决方案
问题(报错信息):Application Server was not connected before run configuration stop, reason: javax.management.InstanceNotFoundException: Catalina:type=Server
解决方案:在使用idea启动tomcat的时候控制台报这个错误,原因是本机的8080端口被占用,在idea里把tomcat的启动端口从新换一个即可
问题(报错信息):org.apache.taglibs.standard.tlv.JstlCoreTLV
根本原因:缺少一个standard-1.1.2.jar
解决办法:在pom.xml中添加standard依赖
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.0.6</version>
</dependency>
问题(报错信息):javax.el.PropertyNotFoundException: The class 'java.lang.String' does not have the property 'id'.
原因:el表达式书写不正确
错误的jsp页面
<c:forEachitems="list"var="carlist">
<tr>
<td>${carlist.id}</td>
<td>${carlist.brand}</td>
<td>${carlist.type}</td>
<td>¥${carlist.price}</td>
<td>
<ahref="delete?id=${carlist.id}"class="layui-btn layui-btn-normal">删除</a>
<ahref="alter?id=${carlist.id}"class="layui-btn layui-btn-normal">修改</a>
</td>
</tr>
</c:forEach>
正确的jsp页面
<c:forEachitems="${list}"var="carlist">
<tr>
<td>${carlist.id}</td>
<td>${carlist.brand}</td>
<td>${carlist.type}</td>
<td>¥${carlist.price}</td>
<td>
<ahref="delete?id=${carlist.id}"class="layui-btn layui-btn-normal">删除</a>
<ahref="alter?id=${carlist.id}"class="layui-btn layui-btn-normal">修改</a>
</td>
</tr>
</c:forEach>
正确的el表达式应该是这样:${变量}