java八大基本數(shù)據(jù)類型 jsp向servlet傳值?
jsp向servlet傳值?您應(yīng)該使用JSP中的代碼請求.setattribute(“x”,“a”)至?xí)?setattribute(“x”,newstring(“a”)。此外,servlet中的代碼
jsp向servlet傳值?
您應(yīng)該使用JSP中的代碼請求.setattribute(“x”,“a”)至?xí)?setattribute(“x”,newstring(“a”)。此外,servlet中的代碼,stringx=(字符串)請求.getattribute(“x”)也應(yīng)更改為以下兩個語句:httpsession=請求.getsession(假)stringx=(字符串)會話.getattribute(“x”)。在代碼中輸出null的原因是在JSP文件中使用null請求.setattribute(“x”,“a”)代碼保存數(shù)據(jù),并且該代碼保存的數(shù)據(jù)只能在同一請求的前提下獲取,不能在其他servlet中獲取。因此,您必須使用會話機(jī)制來正確獲取數(shù)據(jù)。