Win a copy of Head First Android this week in the Android forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

build a list page?

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
author & internet detective
Posts: 40797
829
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 547
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
3 forums:
http://forum.java.sun.com/thread.jspa?threadID=716906&tstart=0
 
Bashar Ayyash
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 40797
829
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 40797
829
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic