3.4.2 Access (GET) Request parameters
1. Methods
String string variable =request.getparameter ("Name property name of the client-supplied parameter");
2. Three forms of parameter transmission
(1) Forward and include actions using JSP
(2) in a JSP page or HTML page
(3) Append the parameters after the URL to pass or append the hyperlink behind the hyperlinks
Code Exercise: 3-8
<body>
<% String current param = "";
String current_vaul= "";
Request.setcharacterencoding ("UTF-8");
Enumeration Params=request.getparameternames ();
while (Params.hasmoreelements ()) {
Current_param= (String) params.nextelement ();
Current_vaul=request.getparameter (Current_param)
%> parameter name:<%=current_param%> parameter value;<%=current_vaul%><br>;
<%}%>
</body>
3.4.3 setting and fetching of new properties
Using the setattribute ("name", obj) method of the Request object on the page, you can set the data obj within the request scope (container), and the requested forwarded page uses getattribute ("name") to
Gets the value of the data obj.
Set data format: void Request.getattribute (String name);
Get data Format: Object Request.getattribute (String name);
JSP review (Part 2)