troubleshooting Question

Javascript while loop with jsp passed value error

Avatar of WarriorHypnotist
WarriorHypnotistFlag for Jordan asked on
JSPJScript
24 Comments3 Solutions482 ViewsLast Modified:
Im trying to create a javascirpt function with jsp code , i have the following :-


<script language=javascript>
var d ='<%=session.getAttribute("num")%>';

function Disable()
{
      
      <%
      int xxx = 0;
      while(xxx < 'd')
      {
              out.println("document.form1.notapp" + xxx + ".disabled = true;");
              xxx++;
      }
      %>
}

The value of d is 4 , but when i run the code it gives up to 100 raws as below

 
<script language=javascript>
var d ='4';
 
function Disable()
{

document.form1.notapp0.disabled = true;
document.form1.notapp1.disabled = true;
document.form1.notapp2.disabled = true;
document.form1.notapp3.disabled = true;
document.form1.notapp4.disabled = true;
document.form1.notapp5.disabled = true;
document.form1.notapp6.disabled = true;
document.form1.notapp7.disabled = true;
document.form1.notapp8.disabled = true;
document.form1.notapp9.disabled = true;
document.form1.notapp10.disabled = true;
....
document.form1.notapp90.disabled = true;
document.form1.notapp91.disabled = true;
document.form1.notapp92.disabled = true;
document.form1.notapp93.disabled = true;
document.form1.notapp94.disabled = true;
document.form1.notapp95.disabled = true;
document.form1.notapp96.disabled = true;
document.form1.notapp97.disabled = true;
document.form1.notapp98.disabled = true;
document.form1.notapp99.disabled = true;
 
}

Can someone explain to me what im doing wrong and why the loop is not stopping correctly , thank you.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 3 Answers and 24 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 24 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros