Studied JSTL - part of experiment
来源:互联网 发布:长春知远画室在哪里 编辑:程序博客网 时间:2024/04/28 11:18
Research of JSTL - part of experiment
1. Assign to a value and test by itself:
<c:set value="${customers}" var="xxxx" scope="page"/>
<c:if test="${xxxx!=null}">
<c:remove var="xxxx"/>
2. To judge a attribute or object and if it’s a null or null string
<c:if test="${customer.address.line2!=null && customer.address.line2!=''}">
,<c:out value="${customer.address.line2}"/>
</c:if>
3. Setting a value then for control operation using condition of the If in the ForEach
<c:forEach var="item" begin="1" end="10">
<c:set var="isLess5" value="${item<5}"/>
<c:if test="${isLess5}"><font color="red"></c:if>
<c:out value="${item}"/>
<c:if test="${isLess5}"></font></c:if>
<br/>
</c:forEach>
4. To set a attribut in whatever using Request,Session or Application,but only the Application can impact the ServletContextAttributeListener
<%session.setAttribute("key","fff");%>
you can access it using method,below:
<c:out value="${key}"/>
5. How can you do when the web.xml have mutli-Listener
<web-app>
<listener>
<listener-class>com.server.InitListener</listener-class>
</listener>
<listener>
<listener-class>com.server.AttributeListener</listener-class>
</listener>
6. Using JSTL create a collection
<%--
please adds this code
<c_rt:set var="tests" value="<%=new java.util.HashMap()%>"/>
--%>
<%request.setAttribute("tests",new java.util.HashMap());%>
7. Setting the property,target and assign to a collection
<c:set var="name" value="Micro"/>
<c:set target="${tests}" property="name">
Hi <c:out value="${name}"/>
<br/>
<%=" I'm not available."%>
</c:set>
<c:set value="I love you" target="${tests}" property="ccccc"/>
<c:set value="I love you1" target="${tests}" property="ddddd"/>
8. To test and out the collection (include escapeXml method)
<c:out value="${tests.length}"/>
You didn't get the value using this method.
<c:forEach items="${tests}" var="test" varStatus="status">
<br/>
<c:out value="${status.count}"/>
{<c:out value="${status.index}"/>}
:
<c:out value="${test.value}" escapeXml="false"/>
</c:forEach>
<c:remove var="tests"/>
<!-- the results -->
You didn't get the value using this method.
1 {0} : I love you
2 {1} : I love you1
3 {2} : Hi Micro
I'm not available. Maurice:Richard
9. What do you need for using Xml target in jdk1.4
Jaxen-full.jar
Jaxp-api.jar
10. What do you need for using Sql target
Jdbc2_0-stdext.jar
<x:parse var="a" >
<?xml version="1.0" encoding="GBK"?>
<a>
<b><c>{中国人}</c></b>
<d>bar</d>
</a>
</x:parse>
<c:out value="${a}"/>
<x:out select="$a//c"/>
<x:out select="$a/a/d"/>
<!-- the results -->
[#document: null] {ÖйúÈË} bar
11. To note have different results
Don’t out: <c:import url="response.xml" var="ccc"/>
Out: <c:import url="response.xml" />
12. Use xml from a importing xml
<%@ taglib prefix="xm" uri="http://java.sun.com/jstl/xml" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<c:import url="response.xml" var="ccc"/>
<xm:parse var="data" xml="${ccc}"/>
<c:out value="${data}"/>
<xm:out select="$data//*"/>
- Studied JSTL - part of experiment
- experiment
- Experiment
- experiment
- Verilog Code of Experiment 3.1.2 [CoC]
- Implementation and Experiment of Multilinear Maps
- List Of Vulnerability Web Application on Hands for Practical Experiment
- This is only a manuscript of libsvm experiment
- analysis of image dataset checking result (image segmentation experiment)
- init of android (part of )
- Summary of this part
- get part of chinese
- English idioms studied this semester
- Implemention of HashTable(Part I)
- the good part of java
- FileTrek2012-be part of them
- Part-of-Speech 标记 含义
- HMM Part-of-Speech Tagging
- 那是一种苛刻的爱...
- jdocs 好东西
- JSTL Specification (1)
- junit中double类型的比较
- 半年工作总结会议
- Studied JSTL - part of experiment
- 使用JSP开发应用程序时的编码(中文等乱码)问题的建议解决方案(包括接受request和数据库操作)
- the several ways of Base64
- 一个完整的SQL SERVER数据库全文索引的示例
- J2EE 组件开发:实体EJB
- 如何简化JDBC代码
- 第一次
- 说不出的感伤,道不出的痛心,忘不掉的回忆,逃不了的现实
- JSP避免Form重复提交的三种方案