[Java Web Study Note]Response,Request Collation

Long time to see.

Request & Reponse are like two paper of our medical record.

 

As everyone knows, Request page has two attributes,one is Parameter,the other is Attribute.

Parameter doesn't hava setter method only getter method.however Attribute has.

Just like our medical record,we record our base infomation such as name,age,sex on the Parameter area;Doctor record the ill case information on the attribute area.Our name,age,sex can't be changed by doctor.Doctor only has the right to record our ill case.

 
Request table
Parameter Attribute
key value key value
name Peter_Xu

ill case 1

xxxxx
age 24 ill case 2 xxxxx
sex gentle    

Doctor has right to getAttribute() our ill information and of course to setAttribute() our ill information and of course to getParameter() our base information but does not have right to setParameter() our base information.

 

Response looks more like the cover page of the medical record,or the command sent by the doctor.

Response page records where you from,where you go.

 

OK,Let's see sth else.

when we want to display sth Chinese infmation,we must use

request.setCharacterEncoding("utf-8");

before

request.getParameter("name");

but this situation is fit for post request.

 

dispatcher & undispatcher

dispatcher:

1 information alive.

2 address unchange.

3 no need to add the web application name

4 dispatcher in the application inner area.

5 one dispatcher.

undispatcher:

1 information lose

2 address change

3 may need application name

4 can redirect to other application

5 repeatedly request.

你可能感兴趣的:(Java Web)