my dog learned polymorphism*
The moose likes JSP and the fly likes Dynamic Reports using jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Dynamic Reports using jsp" Watch "Dynamic Reports using jsp" New topic
Author

Dynamic Reports using jsp

chetan raj
Ranch Hand

Joined: Jul 18, 2006
Posts: 34
I am trying to generate dynamic report for my project
Everytime i will be selecting different fields to be displayed
in the report based on some criteria . My idea is to set the data with is retrived
from resultset into my dto(data transfer object) and display this in jsp.( I am sucessfull in generating the
dynamic query).
But i am facing problem in set the values to dto since my query fields
vary every time. I am not able to understand to which dto property
i have to set values returned from resultset since i do not know in advance which fields will be selected
by user. All the values are coming from only one table.
I am not using any report framework for this project. Can anybody suggest how
this can be solved.

thanks in advance.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

If the key/value pairs are constantly changing, perhaps a DTO, which is best-suited for non-changing properties, isn't the best structure.

Perhaps there is another Java construct (cough, Map) that could hold arbitrary key/value pairs (cough, Map) that you could use.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
John Gregory
Ranch Hand

Joined: Oct 05, 2006
Posts: 115
subtle...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

Originally posted by John Gregory:
subtle...
as a hammer!
[ April 02, 2008: Message edited by: Bear Bibeault ]
chetan raj
Ranch Hand

Joined: Jul 18, 2006
Posts: 34
Hi thanks for the prompt reply.
can anybody give a link
to an example on generating dynamic
reports will be helpful.

thanks in advance
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41108
    
  45
It seems that the question doesn't have much to do with generating reports, but with reading a number of options the user may have selected, and how to generate a database query from that, correct?

In that case, you need to check for all the options (because the user might have selected any or all of them), and generate the query in a way that allows each one of them to be used or not used. Can you think of a way to do that?


Ping & DNS - my free Android networking tools app
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Dynamic Reports using jsp
 
Similar Threads
IndexedProperties doubt
Implementing Patterns
Access DAO Attributes?
IText Problem
Calling another Action