my.jsp必须放在webapp目录下
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>jsp</h1>
<% out.println("hello"); %>
<%= request.getRemoteAddr() %>
</body>
</html>
jsp指令
引入java包
<%@ page import="java.util.*" %>
<% out.println("hello");
int[] ints = {55, 2, 66};
Arrays.sort(ints);
out.println(Arrays.toString(ints));
%>
引入其他jsp页面
<%@ include file="header.jsp"%>
网友评论