Learning log --2019 / 09/03

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/weixin_44757417/article/details/100528540

jsp

jsp action tags

	<jsp:include page=""></jsp:include>
	<jsp:param value="" name=""/>
	<jsp:forward page=""></jsp:forward>

  • jsp:include

    <jsp:include page=“other02.jsp”></jsp:include>

    Contains the specified page, here is the dynamically included. That is not the page tab contains all the elements to take over the entire output, but to take over its operating results.

  • jsp:forward

    <jsp:forward page=""></jsp:forward>

Go which page.

	<% 
		//请求转发
		request.getRequestDispatcher("other02.jsp").forward(request, response);
	%>	
  • jsp:param

It means: When a page containing, or when jumping to a page, adding this parameter.

<jsp:forward page="other02.jsp">
		<jsp:param value="beijing" name="address"/>
	</jsp:forward>
	
	在other02.jsp中获取参数


	<br>收到的参数是:<br>

	<%= request.getParameter("address")%>

jsp built-in objects

The so-called built-in objects that we can use these objects directly in the jsp page. Instead of creating.

  • pageContext
  • request
  • session
  • application

Is more than four scope objects,

  • Scope

Represents the value of these objects can be stored, they have a defined range. setAttribute and getAttribute

使用作用域来存储数据<br>

		<%
			pageContext.setAttribute("name", "page");
			request.setAttribute("name", "request");
			session.setAttribute("name", "session");
			application.setAttribute("name", "application");
		%>
		
		取出四个作用域中的值<br>
		
		<%=pageContext.getAttribute("name")%>
		<%=request.getAttribute("name")%>
		<%=session.getAttribute("name")%>
		<%=application.getAttribute("name")%>

作用域范围大小:

	pageContext -- request --- session -- application 

The difference between four scopes

  • pageContext 【PageContext】

Scope is limited to the current page.

You can also get to eight other built-in objects.

  • request 【HttpServletRequest】

Scope is limited to the first request, as long as the server responded to the request. This stored value, there is no domain.

  • session 【HttpSession】

Scoped to a session (multiple requests and responses) them.

  • application 【ServletContext】

The whole project can access the server can not be shut down after a visit.

Guess you like

Origin blog.csdn.net/weixin_44757417/article/details/100528540