|----${sessionScope.name} 指定必须从session作用域中去找!
|-----两个操作符 前提条件是取出对象或集合
1.点
2.[]
3.两个jsp传递参数,用EL表达式的时候,格式${param.xxx}
EL表达式封装了数据访问的功能,而JSTL标签库则封装了逻辑控制、循环控制以及数据格式化等功能,二者结合使用才能完整实现动态页面的开发需求
|-----什么是jstl?
jsp标准标签库
|-----2:<c:set var="定义一个变量",value="值"> <c:outvalue="${var定义的变量}"/>
c:if作用
如果用name 进行判断,要看name存在什么样作用域? 把作用域 request
jsp页面转发:
<jsp:forwardpage="请求"/> 不一定把所有的格式加载完成!
|-----c:choose c:when c:otherwise 相当于if...else
<c:choose> <c:when test="${not empty person.name }">
<h2>hello,world!</h2> <hr/> <h2> 获取request的值:<br/> ${person.name }<br/> ${person.id }<br/> ${person.address } </h2> <h3> []运算方式:<br/> ${person["name"] }<br/> ${person["id"] }<br/> </h3> <h3> 取出集合(list)的数据:<br/> ${list[1] } </h3> <h3> 取出集合(map)的数据:<br/> ${mp.one }<br/> ${mp["two"] }<br/> ${mp }<br/>
</h3>
</c:when> <c:otherwise> <jsp:forward page="index.jsp"></jsp:forward> </c:otherwise> </c:choose> |
操作行内样式:
<c:forEach items="${list }" var="lst" varStatus="status"> <li <c:if test="${status.index % 2!=0 }">style="background-color:rgb(219,241,212);</c:if>> ${lst.news_title } <span>作者:${lst.news_author }      <a href="admin/news_modify.jsp?uid=${lst.news_id }&ntitle=${lst.news_title}&nauthor=${lst.news_author}&nsummary=${lst.news_summary}&ncontent=${lst.news_content}">修改</a>     <a onclick="del2('${lst.news_id }');">删除</a> </span> </li> </c:forEach> |