File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes build a list page? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "build a list page?" Watch "build a list page?" New topic
Author

build a list page?

Bashar Ayyash
Ranch Hand

Joined: Jun 24, 2004
Posts: 44
Hi guys,

I want to build two jsp pages to display user information from database, as follow:
The first page contains many check boxes each checkbox is for user attribute (a checkbox for user age, another one for user address, another one for user phone, etc.) and the other page displays the checked attributes from the first page, the second page gets the information from MySQL 5.0 database.

So if user checked age, address, phone, and email boxes the second page will display the previous attributes as a list for all users, and if user checked phone and email the second page will display phone and email for all users, and so on.

I just need your thoughts and opinions and if it is possible some links for forums or sites discuss what I want to do, I don't know what's the process name so I described it as I could.

Regards,
[ March 12, 2006: Message edited by: Bashar Ayyash ]
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30352
    
150

Bashar,
It sounds like you want to build the SQL statement based on what the user entered. So there are a few parts to this?

1) Store checkboxes entered by user
2) Build SQL statement with those fields
3) Call getString() for those fields
4) Display those fields to the user

Which of these steps are you looking for more information on?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Peter Sin
Ranch Hand

Joined: Jan 13, 2005
Posts: 547
Hi Bashar,

You have posted this request in another forum. javalobby I think you should have at least done some things yourself such as building the jsp with <input type=checkbox> in a <form> before you ask more details.
stu derby
Ranch Hand

Joined: Dec 15, 2005
Posts: 333
3 forums:
http://forum.java.sun.com/thread.jspa?threadID=716906&tstart=0
Bashar Ayyash
Ranch Hand

Joined: Jun 24, 2004
Posts: 44
Thanx for replying, I know most of the parts you listed
1) How to get checked boxes by using request.getParameter(...);
2) Call getString() for those fields
3) Display those fields to the user by using List or ArrayList

But I want to know how to generate dynamic query based on user checkedboxes.

Please note that I stored user information in multiple tables (for ex. user age, sex, and nationality in tbl_profile, and address, p.o.box, city, and country in tbl_address, and so on)

Thanx for your help,
Bashar Ayyash
Ranch Hand

Joined: Jun 24, 2004
Posts: 44
hi peter and stu, I posted my request to multiple forums to make sure that at least one of them will help me with my request, and peter I already built the forms, servlet and the beans, I'm trying to solve that by my own, anyway I want to tell you one thing that net main goal to make people share knowledge.
[ March 13, 2006: Message edited by: Bashar Ayyash ]
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30352
    
150

Bashar,
For #4, it's just Java logic to build the query:

In pseduo-code
print select
if include column 1
print column 1
if include column 2
if not first
print comma
print column 2
print from ...
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30352
    
150

Bashar,
It's fine to post a hard question to multiple forums, but it's good to start with just one. That way people don't waste their time answering the question if you already have an answer.

Also, more specific questions get better answers. I think this is what Peter was alluding to.

Jeanne
JDBC Forum Bartender
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: build a list page?