|
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%@ include file="/common/taglibs.jsp"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <[url=mailto:%@page]%@page import="com.stu.bean.StudentBean"%> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'TestLogic1.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> logic:equal使用:<br> <% Cookie c = new Cookie("username","Linda"); c.setComment("A test cookie"); c.setMaxAge(3600); response.addCookie(c); %> <logic:equal cookie="username" value="Linda"> UserName in Cookie is Linda<p> </logic:equal> <logic:equal header="Accept-Language" value="zh-cn"> Client's language is:zh-cn.<p> </logic:equal> </body> <% request.setAttribute("intBean",new Integer(100)); %> <logic:equal name="intBean" value="100"> The value of intBean is "100".<p> </logic:equal> <br> logic:notEqual使用:<br> <% StudentBean bean = new StudentBean(); bean.setUsername("Linda"); request.setAttribute("someBean",bean); %> <logic:notEqual name="someBean" property="username" value="Tom"> The name of someBean is not "Tom".<p> </logic:notEqual> <% request.setAttribute("number","100"); %> <logic:equal name="number" value="100.0"> "100" equals "100.0" <p> </logic:equal> <logic:lessThan name="number" value="100.0a"> "100" is less than "100.0a"<p> </logic:lessThan> </html>
|
一共有 0 条评论