Here's the scenerio:
A user enters a table name into a JSP page TEXT field.
I now want to populate a list (combo or whatever) with all the fields in a database table (returned from a RecordSet or Columns object) based on this entered table name -- so the user can pick only the fields he wants.
Then, using this list, I could include the fields the user selected in the dynamically generated SQL statement (that is, I'd process the list and generated the SQL necessary).
(I understand the SQL part, the problem I'm having is building the GUI to get the field list)
Can anybody recommend a good book that shows this technique?
Thanks much in advance.
hope that helps
I have the "Core/More" books for Servlets, but aside from the HTML forms chapter, which doesn't go into detail on this, I don't see anything that can help.
Do you have any suggestions for a good book that details how to do what you're suggesting?
Originally posted by Mike London:
I forgot to mention in my last reply that I understand the meta data stuff and database stuff too.
What I'm missing is building the HTML or other lists/controls to display the fields (in my bean) at runtime and getting interactive user input.
A few thoughts. First, I think you're looking for an HTML <select multiple="multiple"> form field, but I can't tell if that's exactly what you want.
Separately, since you're producing the HTML dynamically, you might want to look at JSTL. Using JSTL to produce a form is more elegant than producing HTML from within a JavaBean; it lets you write and change HTML without having to embed it in Java code. JSTL also has SQL-access tags, but you don't have to use those to generate a form dynamically. My book "JSTL in Action" covers this use of JSTL (to generate and read forms) in detail.
Your book sounds great.
Can you also recommend a good companion book that discusses how to incorporate HTML forms inside beans?
Or, would I just get any good HTML reference book and adapt it to create the necessary HTML inside a bean?
What I'm worried about is that a regular HTML book might not have the build-on-the-fly (in a loop) examples I really am looking for.
Look forward to your reply.