• 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

Problem displaying report using JSP

 
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey guys,

I am developing a simple JSP web application where i need to display the customer details for the whole year in this format.

http://www.imagechicken.com/uploads/1250760495076437000.jpg

See the above image. But now my problem is i am completely out of idea in doing this. Coz i am having two tables and need to retrieve the necessary data's from those table in order to display the report like the above format.

Here is my code to achieve this...



* the iapplicationno is the primary key of the icustomer table and foreign key of txioninstall table.
* a single customer can have more than one entry in txioninstall table,according to the month and year he paid.
* i just need to display the details of customer like in the picture(please see the link), so first i retrieve the aplplication no from icustomer table and look for relevant entry in txioninstall table, and i am able to get the data's but i dont know how to do this. I am having 12 fields representing 12 months and unable to print the value in it.

Please guys shed some light on this issue.. I am very thankful if you'd help me guys...
 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. Can you please show the structure of the two tables as it isn't quite clear from your explanation.

2. You are doing all your business logic inside a JSP. This is a very bad practice. You should have a servlet for this purpose which will do all the logic and forward the request to a JSP...
 
Sheriff
Posts: 67746
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

Rajkumar balakrishnan wrote:Coz i am having two tables ....


Please use real words when posting to the forums. Abbreviations such as "Coz" in place of "because" only serve to make your posts more difficult to read and less likely to generate useful responses.

Please read this for more information.

thanks,
bear
JavaRanch sheriff
 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
icustomer table structure

| iapplicationno | int(10) unsigned | PRI | auto_increment |
| iapplicantname | varchar(45)
| iaddress | varchar(250)
| icity | varchar(45)
| idistrict | varchar(45)
| ipincode | varchar(45)
| imobile | varchar(45)
| iprojectname | varchar(45)
| iplotsize | int(10) unsigned
| iplotno | varchar(45)
| iamount | int(10) unsigned
| isponsorid | varchar(45)
| cdate | date
| istatus | varchar(15) | default= booked
| iphase | varchar(45)

txioninstall table structure

| ireceiptno | int(10) unsigned | PRI | auto_increment |
| iamountrecd | int(10) unsigned
| paidmonth | varchar(45)
| paidyear | varchar(45)
| ichequeno | varchar(45)
| iapplicationno | int(10) unsigned
| iremarks | varchar(45)
| idate | date
| ipaymode | varchar(45)

Please guys help me....
 
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can create separate java classes for icustomer & txioninstall . These will be Java Beans with regular getters and setters.

You can then have a CustomerDB class wherein you can access the database and form an arraylist of all Customers and the corresponding monthwise amounts.

In your JSP you can then call c:forEach and print from the arraylist.

It is a pretty easy affair.
 
reply
    Bookmark Topic Watch Topic
  • New Topic