Wrox Home  
Search P2P Archive for: Go

  Return to Index  

servlets thread: Looping Parameter Problem


Message #1 by "Carlos Arias" <shaydez@r...> on Thu, 10 Oct 2002 02:13:20
> Hi,  I totally understand the concept..  and what the problem was.. You 
are really great help the coding worked.. i been trying to make this work 
for a couple days now .. and just totally blew my brains..   I'm still 
learning all the commands ..  :)   

  Thank you.  
-Carlos  


Hi Carlos,,
u r logic is clear ...
but the data which ur retriving from the form which u consider it as an 
indiaction for u to loop {n times} ...
Carlos Check the 
String countlooping; 
countlooping = request.getParameter("textfield");

u must be aware of that for looping atleast u cannot use a data type 
of "string value" to loop..
cast it to integer for it to work....
int countlooping  = Integer.parseInt(request.getParameter("textfield"));
also catch for null exceptions too
 
Regards
Gautam Khanna
gautamkhanna27@y...
 
 Carlos Arias wrote: Hi, Can anyone help me with a loop situation i'm 
having.
i'm very new to Java and Servlets. to bare with me. 
what i'm trying to do is control how many times a loop loops inside a 
jsp file. 
right now i have: 
for (int i=1;i<=8;i++) {
out.println("I have Looped " + i);
}

now what i'm trying to do is have the form tell the Loop function in the 
JSP file to loop X amount of times: the following code is what i'm trying 
to do . but it doesn't seem to work. 

String countlooping; 
countlooping = request.getParameter("textfield");

for (int i=1;i<=countlopping ;i++) {
out.println("I have Looped " + i);
}
Tomcat tells me that it can't convert int 

what am i doing wrong.. i'm not yet familiar with all the functions and 
statements. am i missing someting or miss using a statement? 
I really need help.. thank you.. 
-Carlos 
---
Change your mail options at http://p2p.wrox.com/manager.asp or 
to unsubscribe send a blank email to 


---------------------------------
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos, & more
faith.yahoo.com

  Return to Index