Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
93
rated 0 times [  94] [ 1]  / answers: 1 / hits: 6055  / 11 Years ago, sat, january 11, 2014, 12:00:00

MyServlet forwards to Mypage.jsp as



request.getRequestDispatcher(/pages_homepage.jsp?value=+count).forward(request, response);


where count is an integer value generated



Below is my JSP code(Mypage.jsp),



<body  onload=getPage('<%request.getParameter(value);%>')>
<div id=app></div>
</body>


Below is my javascript code,



function getPage(match){
var arr = new Array();
var ele = document.getElementById('app');
for(var i=0;i<match;i++){
var newdiv = document.createElement(label);
newdiv.id = arr[i];
newdiv.value=Page;
ele.appendChild(newdiv);
}
}


What I want is that, I want 'Page' to be displayed 'match' number of times. But I'm not being able to do so by the above code. Their might be something wrong with my js code. Can anyone suggest me any corrections?
Thanks in advance.


More From » jquery

 Answers
3

Thanks everyone for their help but I think I got the answer,



Instead of



<body  onload=getPage('<%request.getParameter(value);%>')> 


I wrote,



<body onload=getPage('<%=Integer.parseInt(request.getParameter(value))%>')>


But thanks everyone again for their useful pointers.


[#48788] Friday, January 10, 2014, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
keric

Total Points: 572
Total Questions: 93
Total Answers: 97

Location: Cyprus
Member since Mon, Oct 24, 2022
2 Years ago
;