2017-08-04 113 views
0
for (int i = 1; i <= 3; i++) 
{ 
    ques1 = (String)request.getParameter("ques%><%=i%><%"); 
    out.println(ques1); 
} 

我只想從ques1,ques2,ques3等等的HTML頁面獲取參數。但它給未終止的字符串文字。如何使用jsp關鍵字從html頁面檢索數據?

我的HTML輸入:

Enter Question No. <%=i%> :: <input name="ques<%=i%>" required> 

回答

0

嘗試更改爲:

for (int i = 1; i <= 3; i++) 
{ 
    ques1 = (String)request.getParameter("ques" + i); 
    out.println(ques1); 
} 
相關問題