发表于: 2018-03-05 23:47:51
1 537
完成
1.写了几个核心的c标签(参考:http://www.runoob.com/jsp/jsp-jstl.html)
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<h1><c:out> 实例</h1>
<c:out value="<要显示的数据对象(未使用转义字符)>" escapeXml="true" default="默认值"></c:out><br/>
<c:out value="<要显示的数据对象(使用转义字符)>" escapeXml="false" default="默认值"></c:out><br/>
<c:out value="${null}" escapeXml="false">使用的表达式结果为null,则输出该默认值</c:out><br/>
<c:set var="salary" scope="session" value="${2000*2}"/>
<c:out value="${salary}"/>
<p>salary 变量值: <c:out value="${salary}"/></p>
<c:remove var="salary"/>
<p>删除 salary 变量后的值: <c:out value="${salary}"/></p>
<c:catch var="catchException">
<% int x = 5 / 0;%>
</c:catch>
<c:if test="${catchException != null}">
<p>异常为 : ${catchException} <br/>
发生了异常: ${catchException.message}</p>
</c:if>
<c:set var="salary" scope="session" value="${2000*2}"/>
<c:if test="${salary > 2000}">
<p>我的工资为: <c:out value="${salary}"/><p>
</c:if>
<p>你的工资为 : <c:out value="${salary}"/></p>
<c:choose>
<c:when test="${salary <= 0}">
太惨了。
</c:when>
<c:when test="${salary > 1000}">
不错的薪水,还能生活。
</c:when>
<c:otherwise>
什么都没有。
</c:otherwise>
</c:choose><br/>
<c:forEach var="i" begin="1" end="5">
Item <c:out value="${i}"/><p>
</c:forEach>
<c:forTokens items="google,runoob,taobao" delims="," var="name">
<c:out value="${name}"/><p>
</c:forTokens>
<h1><c:url>实例 Demo</h1>
<a href="<c:url value="http://www.baidu.com"/>">
这个链接通过 <c:url> 标签生成。
</a>
运行结果
<c:out> 实例
<要显示的数据对象(未使用转义字符)>
<要显示的数据对象(使用转义字符)>
使用的表达式结果为null,则输出该默认值
4000
salary 变量值: 4000
删除 salary 变量后的值:
异常为 : java.lang.ArithmeticException: / by zero
发生了异常: / by zero
我的工资为: 4000
你的工资为 : 4000
不错的薪水,还能生活。
Item 1
Item 2
Item 3
Item 4
Item 5
runoob
taobao
<c:url>实例 Demo
2.花了半天时间熟悉debug调试,明天小课堂讲这个
今天日报很水,看了很多杂七杂八的知识点,很零散,就不写出来了。
问题
控制器里/t11改为/u/t11找不到所需网页,之前是这样写的
template="jsp/t10template.jsp"
template改为这样即可,还不知道为什么
<definition name="base" template="/jsp/t10template.jsp">
<put-attribute name="title" value=""/>
<put-attribute name="header" value="/jsp/t10header.jsp"/>
<put-attribute name="menu" value=""/>
<put-attribute name="footer" value="/jsp/t10footer.jsp"/>
</definition>
收获
更熟悉debug
计划
小课堂
提交任务5
评论