Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 10th, 2004, 09:15 AM
Registered User
 
Join Date: Mar 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default new to jsp...got a checkbox prob

hi,

got a bit of a chkbox prob!

this is the code i have written:

<%
int i;

for (i = 0; i < 1; i++){
int mess = 0;
if (mess >= 0){
mess = mess + 1;

%>
<td><input type="checkbox" name="<%=mess%>"></td>
<%}
}%>

with this code my chkboxes are not incrementing. wen i check the source code after deployed it says 1 for each of the checkboxes.
basically i want each of the checkboxes to have a unqiue value...any ideas on how i can do that?

thanks

seema
ps. if u need more infor ask!

Reply With Quote
  #2 (permalink)  
Old March 25th, 2004, 10:44 PM
Registered User
 
Join Date: Mar 2004
Location: Pasig, , Philippines.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to fernce Send a message via Yahoo to fernce
Default

hi,

your code is good but you over look putting your variable,
your mess ( int mess = 0; ) variable is not suppose to be inside of you looping because every time that your loop turn it back on the top your variable mess would be set again into zero.

I modified you code. Try this

<%
int i;
int mess = 0;
for (i = 0; i < 1; i++){
if (mess >= 0){
mess = mess + 1;

%>
<td><input type="checkbox" name="<%=mess%>"></td>
<%}
}%>



Fernce


Reply With Quote
  #3 (permalink)  
Old March 26th, 2004, 09:43 AM
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Plus it looks like (forgive me if I'm wrong) only one checkbox will be written with the code you've posted.

----------
---Snib---
----------

<><
Reply With Quote
  #4 (permalink)  
Old April 8th, 2004, 01:50 AM
Registered User
 
Join Date: Apr 2004
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The reason you got only one checkbox is because you set the limit to 1 in "i<1". If you want to generate ten checkboxes, try this instead:

<%
int param = 10;
for (int i = 0; i < param; i++){
%>
<td><input type="checkbox" name="<%=i%>"></td>
<% } %>



Regards,
kokyan
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
checkbox checked by default by html:checkbox sachin.tathod Struts 3 December 4th, 2006 03:41 PM
Please Help. mr_newreq.jsp:78: jsp:useBean can't f batken JSP Basics 0 February 22nd, 2006 09:56 PM
JSP Multiple delete Checkbox joepublic JSP Basics 1 February 17th, 2005 02:57 PM
Prob.s with ch.16 of Profes. JSP 2nd Ed. bobbob Pro JSP 1 April 5th, 2004 06:29 AM
Prob.s running Profes. JSP 2nd Ed. ch16 examp.s bobbob JSP Basics 0 February 6th, 2004 09:50 PM



All times are GMT -4. The time now is 05:31 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.