0、Controller层出现Could not autowire. No beans of ‘RecordService’ type found:
解决:在ServiceImpl里,类前面加上@Service
1、输入框为disable="disable"时,无法post到后台:
解决:将disable="disable"改为readonly=“readonly”,即可post到后台
2、页面状态500,空指针异常:
Request processing failed; nested exception is java.lang.NullPointerException
解决:没有注入那个被调用的类,因此,只需要进行注入就好了。在Controller中加上@Autowired就行了。
3、前端嵌入代码:
解决:使用脚本片段<%%>嵌入代码,使用<%=%>将表达式输出到jsp页面中。
例如:
嵌入类型判断代码:
<%
String type;
UserInfo userInfo = (UserInfo) session.getAttribute("userInfo");
//判断用户类型
if(userInfo.getType()==1)
{type="管理员";}
else
{type="普通员工";}
%>
在jsp页面中输出:
<input type="text" disabled="disabled" name="type" value="<%=type%>">
4、<c:if><c:forEach>在jsp中进行条件判断、遍历:
解决:
<c:forEach>
<c:forEach var="property" items="${infos}">
<td>${property.id}</td>
</c:forEach>
<c:if>
<c:if test="${property.loan ==true}">
<td>已借出</td>
</c:if>
<c:if test="${property.loan ==false}">
<td>未借出</td>
</c:if>