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