Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
  #1  
Old December 31st, 2000, 01:31 PM
Borasal Borasal is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2000
Location: Ankara,Etlik,TURKEY
Posts: 0 Borasal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Borasal
hello,
i am a newbie in servlets. i am trying to design a student grading system. If a teacher wants to input grades, he will choose a lesson and see the students taking that lesson.My problem starts here. Every student must have an inputbox near him for entering his grade. But number of students are dynamic.
So, the number of inputboxes must be dynamic. I don't know how to do this.
For example, i will choose a lesson and all students(for example, 23) taking that lesson will be shown on an HTML page and there will be 23 inputboxes near them. i will eneter grades in this inputboxes and when i submit, all student grades will be recorded to the database at the same time.
I don't know how to do it dynamically.is it possible to use arrays for inputboxes( like inputbox[1], inputputbox[2],etc.) in HTML?
Please help me immediately. Source code will be appreciated. And happy new year to all!!!

Reply With Quote
  #2  
Old January 2nd, 2001, 01:21 AM
billylau billylau is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2000
Posts: 12 billylau User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I guess the easiest way to do it is to use some hidden field to keep a counter for how many student you got, and use a for loop to generate input field:

assume counter = 23 in your case;

out.println("<input type='hidden' name='counter' value='"+counter+"'>");
for (int i=0; i<counter; i++)
out.println("<input type='text' name='input"+i+"'>");

Then you can apply the same concept on getParameter:

int counter = Integer.parseInt(request.getParameter("counter"));

int counter[] = new int(counter);
for (int i=0; i<counter; i++)
counter[i] = Integer.parseInt(req.getParameter("input"+i));

Hope this would help.

Reply With Quote
  #3  
Old January 3rd, 2001, 06:18 PM
Borasal Borasal is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2000
Location: Ankara,Etlik,TURKEY
Posts: 0 Borasal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Borasal
Thank you very much. URL It was really so important for me. I will use it in my project

<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by billylau:
I guess the easiest way to do it is to use some hidden field to keep a counter for how many student you got, and use a for loop to generate input field:

assume counter = 23 in your case;

out.println("<input type='hidden' name='counter' value='"+counter+"'>");
for (int i=0; i<counter; i++)
out.println("<input type='text' name='input"+i+"'>");

Then you can apply the same concept on getParameter:

int counter = Integer.parseInt(request.getParameter("counter"));

int counter[] = new int(counter);
for (int i=0; i<counter; i++)
counter[i] = Integer.parseInt(req.getParameter("input"+i));

Hope this would help.
[/quote]


Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > Getting user input from the html page


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway