[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

creating table rows dynamically in servlet

Posted on 2004-09-03
3
Medium Priority
?
1,325 Views
Last Modified: 2013-11-24
Dear All,
   I am in need of answer for this query very urgently.

      The user will give me the input for no of uploads for example 23. Based on the input i have to create table rows each page should contain 10 rows each. So if the input is 23 then i have to show 3 pages having 10 rows each in first two page and 3 rows in third page. The first page should contain a navigation button to go the second page and in the same for the second page for third page and so on based on the input value.

  I have to do this using servlet ........

  kindly help me as early as possible.

   
0
Comment
Question by:priyashree
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 1

Accepted Solution

by:
mlpk_tyr earned 300 total points
ID: 11988903
hi,
i give you a hint and develop this with syntactical changes

int totalRec = request.getParameter("totalrecords"); // maximum no of records  your case 23
int currindex=request.getParameter("currindex");   // the  page list number  requested
int temp=( (totalRec/10) *10) ;
if(  temp != totRec)
      int totpages=  temp+1;
else{
       int totpages=  temp;
}
int startlist = 1+ ( (currindex-1)*10 );    // if  requested page number is 2  then starting number is 11
if( totalRec-startlist > 9 )    {                     // if we have 16 records thenending number is 16
         int endlist= 1+ ( (currindex)*10 )       // this is 16 else it will be 20
}else{
         int endlist= totalRec;
}

for(int i=startlist;i<endlist; i++){
out.writeln("<html>");
out.writeln("<form>");
out.writeln("<table>");
if(totalRec>0){
out.writeln("<tr><td> ");
out.writeln("input type='select' name=' currindex' ")
for(int i=1;i<totpages;i++)  out.writeln("<options value='"+ i + "' >"+ i + " </option>")
out.writeln("</td></tr>");
}

for(int j=1 ;j<10 ;j++){
out.writeln("<tr><td>);
out.witeln("<input type='text' name ='t1"+ j +"'  value>")  //put whatever element you want to have for  each row, make sure that you create an array of elements
out.writeln("</td></tr>);
}
out.writeln("</table>");
}
out.writeln("input type='submit'>");

out.writeln("</form>");
out.writeln("</html>");
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Make the most of your online learning experience.
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question