Difference between getattribute and getparameter1. getattribute is the attribute set by setattribute in JSP.
2. What parameter gets is string; what attribute gets is object.
3. request. the data transmitted by the getparameter () method is
There are a lot of information on the Internet, but they are all chaotic. Record points are used as a reference. Difference between getattribute and getparameter 1. getattribute is the attribute set by setattribute in JSP.
2. What parameter gets is
Use the filter and modifier design mode (static proxy) to solve the getParameter garbled problem, getparameter Chinese garbled
The post garbled problem is better solved. Here we mainly deal with the garbled get request.
Solution: Enhance the
Request. the data transmitted by the getParameter () method is transmitted from the Web Client to the Web server, representing the HTTP request data; request. the data transmitted by the setAttribute () and getAttribute () methods only exists in the
Request.getattribute (): Is the value of the variable set at request, with Request.setattribute ("name", "Your Own value"), to set the value,Request.getparameter (): Extract the parameters sent over such as: this pagehttp://community.csdn.net/Expert/
1. getAttribute is used to obtain the setAttribute in jsp? Specified attribute2. What parameter gets is string; what attribute gets is object.3. request. the data transmitted by the getParameter () method is transmitted from the Web client to the
1. getattribute is the attribute set by setattribute in JSP.2. What parameter gets is string; what attribute gets is object.3. request. the data transmitted by the getparameter () method is transmitted from the Web Client to the Web server,
1. session. setattribute () and session. getattribute () are used in pairs. The scope is used throughout the session and all pages use the data.
2. The request. setattribute () and request. getattribute () pairs are used between the request and the
Request. getparameterIs used to accept parameters from the get or POST method OK Only java. Lang. string can be accepted.That is, string parameter _id = request. getparameter ("parameter _id ");Request. getattributeIs used to accept variables or
(2) When the two Web Components are link relationships, the linked component obtains the request parameters through the GetParameter () method.(3) When a forwarding relationship is between two Web components, the forwarding target component shares
The HttpServletRequest class has GetParameter (), getattribute (), setattribute (), and no Setparameter () method
GetParameter () is used to post or get the form, to obtain the data in the form, or the parameters on the URL.
When the Web component
The httpservletrequest class includes both the getattribute () method and the getparameter () method. The two methods have the following differences:
(1) The httpservletrequest class has the setattribute () method instead of the setparameter ()
Abstract online:
1. at a deeper level, the data transmitted by the request. getparameter () method will be transmitted from the Web Client to the Web server, representing the HTTP request data.The request. getparameter () method returns
Getparameter returns a string used to read the values in the submitted form. (page parameters and strings) such? Id = 123.The object returned by getattribute must be converted. You can use setattribute to set it to something that is flexible and can
1. simple comparison
Request. getparameter is more familiar than parameter.
Request. getparametervalues (string name) is used to obtain data such as the checkbox class (with the same name but multiple values. Receives array variables, such as the
I,Simple comparison
Request. getparameter is familiar with many applications.
Request. getparametervalues (string name) is used to obtain data such as the checkbox class (with the same name but multiple values. Receive array Variables, Such as
The GetParameter method gets the request parameters for the form or URL. Parameters are passed from the Web client to the Web service side. For example, a servlet like the following:@WebServlet (name = "HelloServlet", Urlpatterns = {"/hello")})
When you want to pass a common data type to the next page, you can use the getparameter () method on the next page to obtain the data passed on the previous page! (Common data types refer to basic types commonly used in Java, such as int, float,
Httpservletrequest.getparameter ("modelname"); Can you get the modelobject you want? After testing, the discovery is not possible. Then think about it, the other reason is quite simple, when the two Web components are a forwarding relationship, the
The httpservletrequest class includes both the getattribute () method and the getparameter () method. The two methods have the following differences:
(1) The httpservletrequest class has the setattribute () method instead of the setparameter ()
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.