本文实例讲述了JSP中隐式对象用法。分享给大家供大家参考,具体如下:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %>My JSP 'demo1.jsp' starting page <% Date date=new Date(); out.write(date.toLocaleString()+"
"); %> <% //域之间的信息获取 request.setAttribute("data", "abc");//request的域 String data=(String)pageContext.getAttribute("data", PageContext.REQUEST_SCOPE);//用pageContext域获取Request域的内容 out.write(data+"
"); String data2=(String)pageContext.findAttribute("data");//直接寻找data out.write(data2+"
"); %> ${data}
希望本文所述对大家JSP程序设计有所帮助。
关键字词: