介绍
JSP内置9个隐式对象在<% %>内调用(因为<% %>定义在_jspservice()内)。这些对象不需要new就可以调用。
4个域对象、response、request、out、其它
使用
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <head> <title>Title</title> </head> <body> <% response.getWriter().write("hello world!"); %> <br/> <% out.println("out hello world!"); %> <br/> <% Cookie cookie = new Cookie("username","cw"); Cookie cookie1 = new Cookie("password","123123"); cookie.setPath("/"); cookie1.setPath("/"); cookie.setMaxAge(60*60); cookie1.setMaxAge(60*60); response.addCookie(cookie); response.addCookie(cookie1); %> </body> </html>