This article will introduce you to an example of object change caused by different JSP threads. I hope this tutorial will be helpful to you.
| The Code is as follows: |
Copy code |
<%
Final HttpServletRequest f = request;
System. out. println ("sdaddsdasdsd ");
New Thread ()
{
Public void run ()
{
RequestDispatcher rd;
Try
{
F. setCharacterEncoding ("gb2312 ");
}
Catch (Exception e)
{
E. printStackTrace ();
}
String SiteName = f. getParameter ("SiteName ");
String Name = f. getParameter ("Name ");
String userAccount = f. getParameter ("userAccount ");
String userPasswd = f. getParameter ("userPasswd ");
String databaseAddress = f. getParameter ("databaseAddress ");
String databaseName = f. getParameter ("databaseName ");
String databaseAccount = f. getParameter ("databaseAccount ");
String databasePasswd = f. getParameter ("databasePasswd ");
System. out. println (SiteName );
System. out. println (Name );
System. out. println (userAccount );
System. out. println (userPasswd );
System. out. println (databaseAddress );
System. out. println (databaseName );
System. out. println (databaseAccount );
System. out. println (databasePasswd );
New org. Rudiment. Blog. Install (SiteName, userAccount, userPasswd, Name, databaseAddress, databaseName, databaseAccount, databasePasswd, f );
}
}. Start ();
%> |
Sysyem. out. println () All are null
If it is placed outside the Thread, the value can be obtained. This will be studied later. Share it.