According to TLD or attribute directive in tag file, attribute value does not accept any expressions
在運用標準標簽庫和EL表達式寫JSP頁面的時候,有時候會報500錯誤
?
?
執行某jsp頁面時,彈出如標題所示異常,jsp代碼如下:
<%@ page language="java" contentType="text/html;charset=gbk" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>?
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
? <head>
??? <base href="<%=basePath%>">
? </head>
??
? <body>
??? This is the result:
??? <c:out value="${userInfo}" default="沒有結果"/>
? </body>
</html>
異常的原因是不能識別“${userInfo}”,解決辦法有兩種:
一、在page指令里,加入isELIgnored="true"屬性,即
<%@ page language="java" contentType="text/html;charset=gbk"? isELIgnored="true" %>
二、把<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>變為:
<%@ taglib prefix="c" uri=http://java.sun.com/jstl/core_rt ?%>
經過改動之后,jsp頁面能正常執行了。
轉載于:https://www.cnblogs.com/yuanlaihenkuang/p/7348450.html
《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀總結
以上是生活随笔為你收集整理的According to TLD or attribute directive in tag file, attribute value does not accept any expressions的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 移动端适配与响应式布局
- 下一篇: sqlserver数据文件位置如何迁移