wood burning stoves 2.0*
The moose likes JSP and the fly likes Problem displaying report using JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Problem displaying report using JSP" Watch "Problem displaying report using JSP" New topic
Author

Problem displaying report using JSP

Rajkumar balakrishnan
Ranch Hand

Joined: May 29, 2008
Posts: 445

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...


Never try to be a hard-worker. Be a smart-worker.
My Blog
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

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...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

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

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rajkumar balakrishnan
Ranch Hand

Joined: May 29, 2008
Posts: 445

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....
Sunder Ganapathy
Ranch Hand

Joined: Apr 01, 2003
Posts: 120
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem displaying report using JSP
 
Similar Threads
page refresh problem
resizing table width
Getting null while trying to get value of Multiple list
Paging in jsp
JSP attendance management project error