<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.util.Date"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>


<%
int a =1;
int b =2;
request.setAttribute("ab", a);
request.setAttribute("b", b);



%>
<jsp:forward page="top.jsp"/>
</body>

</html>
<%@page import="java.text.SimpleDateFormat"%>

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<% 



System.out.println(request.getAttribute("ab"));
System.out.println(request.getAttribute("b"));

String b = request.getAttribute("b").toString();
%>
<%=request.getAttribute("b")%>
<%=b %>
</body>
</html>

jsp内置对象request使用方法2

jsp内置对象request使用方法2

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-04
  • 2022-01-01
  • 2021-07-30
  • 2021-07-17
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-05-28
  • 2021-09-24
  • 2021-05-06
  • 2021-06-11
  • 2021-06-17
相关资源
相似解决方案