• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Multiple loop operation for JSP and Servlet

 
Greenhorn
Posts: 3
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I'm trying to make a program for room renting service, where I'm capturing the information of whole building as per the user input..

I'm restricted to use Servlet and JSP, I'm stuck in this program for long....

Here is my sample code to understand the logic..

Thanks in advance..


<h1>Enter The Details of Your property</h1>
<form action="property_register" method="post">
<table style="with: 50%">
<tr>
<td>Floor Number</td>
<td><input type="text" name="Floor_num" /></td>
int Floor_num = input.nextInt();
String Floor_numArray[] = new String[Floor_num];
input.nextLine();
for(int i = 0; i < Floor_numArray.length; i++)
{
<td>Total Room</td>
<td><input type="text" name="Total_room" /></td>
for(int i = 0; i < Floor_numArray.length; i++)
{
int Total_room = input.nextInt();
String Total_roomArray[] = new String[Total_room];
input.nextLine();
for(int j=0; j<Total_roomArray.length; j++)
{
<td>Rent Per Month</td>
<td><input type="text" name="Rent_perMonth" /></td>
int Rent_perMonth = input.nextInt();
String Rent_perMonthArray[] = new String[Rent_perMonth];
input.nextLine();

<td>Rent Per Day</td>
<td><input type="text" name="Rent_perDay" /></td>
int Rent_perDay = input.nextInt();
String Rent_perDayArray[] = new String[Rent_perDay];
input.nextLine();

<td>Enter the Deposit</td>
<td><input type="text" name="Deposit" /></td>
int Deposit = input.nextInt();
String depositArray[] = new String[Deposit];
input.nextLine();

<td>Available From</td>
<td><input type="text" name="Available_from" /></td>
int Available_from = input.nextInt();
String Available_from Array[] = new String[Availablr_from];
input.nextLine();
}
}
}
 
Bartender
Posts: 667
14
TypeScript Fedora
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What's your problem?
 
Al Hobbs
Bartender
Posts: 667
14
TypeScript Fedora
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually....... you have java code slapped in an html page... No wonder it doesn't work.  
 
M Shekhar
Greenhorn
Posts: 3
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry I posted the wrong codes. I tried this code as a java application but now I want to implement it on JSP and Servlet but I don't know how to do it..

 
Al Hobbs
Bartender
Posts: 667
14
TypeScript Fedora
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok so if want to make a web app you arent going to be getting input using the console.  I think make you should read up on basic jsp and servlet first.
 
Sheriff
Posts: 67745
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Read this article to understand what JSP is and how it operates.

Then read this article to understand how to properly structure Java web applications.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hard to read text plain
 
Al Hobbs
Bartender
Posts: 667
14
TypeScript Fedora
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should probably find resources in your native language.  Just search java and jsp on google.
reply
    Bookmark Topic Watch Topic
  • New Topic