1. Javascript parameter passing: this parameter passing method uses the opener keyword to implement cross-page parameter passing. Its usage is to use the opener keyword to call a component of the parent form.
Example: opener.myform.txt. value = document.myform.txt. value;
Advantage: it is simple, and limits on network transmission are relatively low.
Disadvantages: not flexible. It is neither realistic nor practical to transmit a large number of parameters.
2 ."? "Parameter passing: add? The parameter name and value are followed. You can use request. getparameter ("parameter name") on another JSP page to obtain the passed parameter.
Example: http: // localhost: 8080/BBS/tiezi/jishu. jsp? Id = 1
Advantage: flexible, you only need to put the parameters to be passed into a variable and pass them to the passed interface.
Disadvantage: it is unrealistic to PASS Parameters in batches.
3. session parameter passing: it is usually used to maintain the state. there are two parameters in the session. The first parameter is the identifier, and the second parameter is the value. In the form ("key", "value"), if your thinking is agile, you can think of a scattered list, this is an implementation of the hash.
Example: Session. setattribute ("login", "OK"); Session. getattribute ("login ");
Advantage: you do not need to care about any data types. You can put them in the session. They are stored in the hash as objects.
Disadvantage: All data in the session is accessed as an object, so we need to forcibly convert the type to the type we need every time we use it.
4. javaBean parameter passing: This is the highest-level parameter passing. It encapsulates any data type and method in JavaBean. we can define the parameters to be passed in the attributes, and then add a get and set methods. We can set the lifecycle of parameters to complete the process of passing parameters when calling in JSP.
Example:
Package bean;
Public class samplebean
{
Private string sample = "star value ";
Public String getsample ()
{
Return sample;
}
Public void setsample (string newsample)
{
If (newsample! = NULL)
{
Sample = newsample;
}
}
Advantages: flexible and diverse, passing data structures such as arrays, objects, hash tables, and so on.
Disadvantage: It is time-consuming and labor-consuming to write different JavaBean based on different passing parameters.
Everything has its advantages and disadvantages. Everything has two sides. We cannot use one transmission method unilaterally. We should choose one transmission method based on the actual situation and actual needs.
The above is summarized over the past few days. If there is anything lacking or wrong, I hope you can give some advice.