Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

build a list page?

 
Bashar Ayyash
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author & internet detective
Marshal
Posts: 34422
347
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Peter Sin
Ranch Hand
Posts: 547
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 333
 
Bashar Ayyash
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author & internet detective
Marshal
Posts: 34422
347
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author & internet detective
Marshal
Posts: 34422
347
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic