首页 > 编程知识 正文

html字符串转换为html,java和jsp的区别

时间:2023-05-06 04:20:36 阅读:135097 作者:4040

jtl % 20 % E6 % A0 % 87 % E7 % ad % be5 % ba % 93 % 20js TL % 20 % E6 % A0 % 87 % E7 % ad % be5 % ba % 93 % E5 % 25 % 25 % 200 0 % E4 % bb % a3 % E7 % A0 % 81 % E7 % 9a % 20js p % 20 % E6 % A0 % 87 % E7 % ad % be5 % ba % 93 % E3 % 80 % 82 % 002 % 204 % ba 6 % 98 % af % E4 % b8 % ba % E4 % ba % 86 % E6 % 9b % BF % E6 % 8d % a2 % E4 % bb % a3 % E7 % A0 % 81 % E8 % 84 % E6 % 25 % 206 % 25 8 % E5 % BF % 83 % E6 % A0 % 87 % E7 % ad % be5 % ba % 93 % e9 % 87 % E7 % 82 % B9 % 29 % 2033 358 % 20 sun.com % 2f JSP % 2f JSP % 2f JSP % 2f ion % 20 % 94 % A8 % 29 % 2033 358 Java.sun.com % 2f JSP % 2f jstl % 2f SQL % 20 sqlxml % 28 % E4 % b8 % 8d % E4 % BD % BD % BF % E7 taglib % 20 % E6 % 8c % 87 % 20e6% A0 % 87 % E7 % ad % be % E5 % ba % 93 % 25 % 40 % 20 taglib % 20 prefix % 3d % 27c % 27 uri % 27 d % 273358 Java.sun.com % 2f JSP % 2f jstl % 2f XML % 27 % 20 % 25 % 20 % 27 fmt % 27 % 20 uri % 3d % 27http://Java.sun.com % 2f jsun.com % 27 un.com % 2f JSP % 2f jstl % 2f SQL % 27 % 20 % 25 functions % 20 % E6 % A0 % 87 % E7 % ad % be5 % ba % 93 % 25 % 40 % 202 f jstl % BF % E7 % 94 % AAA % 200 % E6 % A0 % 87 % E7 % ad % be5 % ba % 93 % E7 % 9a % 84 % 20 jar % 20 % E5 % 8c % 85 % E3 % 80 % 82 taggggg % 8c % 87 % E4 % bb % a4 % E5 % BC % 95 % 2027 c % 27 % 20 uri % 3d % 273358 Java.sun.com % 2f JSP % 2f jstl % 2f core % 27 % 20 % E5 % B0 % 91 % 29 % E4 % BD % 9c % E7 % A8 % ef % BC %9AAA % 20 % 9d % E5 % ad % 98 % E6 % 95 % B0 % E6 % 8d % AE % E3 % 82 5 % E6 % 8d % ae3 % 80 % 82 % E5 % 9f % E5 % af % B9 % 25 % 20e % E7 % BD % ae4 % BF % 9d % ad % 98 % E5 % 88 % B0 % E5 % ba % 20 request % 20 % E5 % 9f session % 20 % E8 % a1 % A8 % E7 % a4 % 20 context % 20 % E5 % 9f %9fvar % 20 % E5 % B1 % E6 % 80 % B9 % 8b % E5 % 89d % ef % BC % 9a % 24 % 7b % 20 session scope.ABC % 20 % 7d % 25 % 20bc value % 27 % 2f % E4 % BF % 9d % E5 4 % A8 % E6 % a5 % E5 % 81 % 9a % 20if % 20 % E5 % 88 % a4 % E6 % 96 % ad % E3 % 80 % 82 % 00a % 20 % 25 % 20if % 20 % E5 % 88 1 % A8 % E8 % be % be5 % BC % 8f % E8 % be % 93 % E5 % 87 % ba % ef % BC % 89-% c : if % 20 test % 3d % 20 % 2fc 3360 IFC 360 IFC E7 % AAA % 20 ose % 20c : when % 20c : otherwise % E6 % A0 % 87 % E7 % ad % be % 20 % E4 % BD % 9c % E7 % 94 % A8 % ef % BC 6 % a5 % E8 % BF % 91 % E3 % 80 % 80 % 25 % 20 % ad % be % E4 % BD % 9c % E7 % 94 % A8 % ef % BC % 9a % E5 % a4 % B7 % af % E5 % af % E5

.height > 180 }"><h2>很高</h2></c:when><c:when test="${ requestScope.height > 170 }"><h2>还可以</h2></c:when><c:otherwise><c:choose><c:when test="${requestScope.height > 160}"><h3>大于 160</h3></c:when><c:when test="${requestScope.height > 150}"><h3>大于 150</h3></c:when><c:when test="${requestScope.height > 140}"><h3>大于 140</h3></c:when><c:otherwise>其他小于 140</c:otherwise></c:choose></c:otherwise></c:choose> (4)<c:forEach />

作用:遍历输出使用。

1.遍历 1 到 10,输出 <%--1.遍历 1 到 10,输出begin 属性设置开始的索引end 属性设置结束的索引var 属性表示循环的变量(也是当前正在遍历到的数据)for (int i = 1; i < 10; i++)--%><table border="1"><c:forEach begin="1" end="10" var="i"><tr><td>第${i}行</td></tr></c:forEach></table> 2. 遍历 Object 数组 <%-- 2.遍历 Object 数组for (Object item: arr)items 表示遍历的数据源(遍历的集合)var 表示当前遍历到的数据--%><%request.setAttribute("arr", new String[]{"18610541354","18688886666","18699998888"});%><c:forEach items="${ requestScope.arr }" var="item">${ item } <br></c:forEach> 3. 遍历 Map 集 <%Map<String,Object> map = new HashMap<String, Object>();map.put("key1", "value1");map.put("key2", "value2");map.put("key3", "value3");// for ( Map.Entry<String,Object> entry : map.entrySet()) {// }request.setAttribute("map", map);%><c:forEach items="${ requestScope.map }" var="entry"><h1>${entry.key} = ${entry.value}</h1></c:forEach> 4. 遍历 List 集合—list 中存放 Student 类,有属性:编号,用户名,密码,年龄,电话信息 public class Student {//4.编号,用户名,密码,年龄,电话信息private Integer id;private String username;private String password;private Integer age;private String phone; <%--4.遍历 List 集合---list 中存放 Student 类,有属性:编号,用户名,密码,年龄,电话信息--%><%List<Student> studentList = new ArrayList<Student>();for (int i = 1; i <= 10; i++) {studentList.add(new Student(i,"username"+i ,"pass"+i,18+i,"phone"+i));}request.setAttribute("stus", studentList);%><table><tr><th>编号</th><th>用户名</th><th>密码</th><th>年龄</th><th>电话</th><th>操作</th></tr><%--items 表示遍历的集合var 表示遍历到的数据begin 表示遍历的开始索引值end 表示结束的索引值step 属性表示遍历的步长值varStatus 属性表示当前遍历到的数据的状态for(int i = 1; i < 10; i+=2)--%><c:forEach begin="2" end="7" step="2" varStatus="status" items="${requestScope.stus}" var="stu"><tr><td>${stu.id}</td><td>${stu.username}</td><td>${stu.password}</td><td>${stu.age}</td><td>${stu.phone}</td><td>${status.step}</td><%--status 实现了LoopTagStauts接口:方法:1. public Object getCurrent(); //获取当前遍历到的数据2. public int getIndex(); //表示获取遍历的索引3. public int getCount(); //表示遍历的个数//获取第一个、最后一个、步长的属性值4. public Integer getBegin(); 5. public Integer getEnd(); 6. public Integer getStep(); //表示当前遍历的数据是否是第一条、最后一条。7. public boolean isFirst();8. public boolean isLast();--%></tr></c:forEach></table>

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。