JavaScript/JAVA and forms-based page

conjur

No Lifer
Jun 7, 2001
58,686
3
0
Hey, all.

I'm making my first venture into JavaScript/JAVA and have some questions.

I have a .jsp page with a form on it. On that form are two listboxes. I want the content of the first listbox to limit the content of the 2nd listbox based on a SQL query. Once the 2nd listbox is selected I want to fill a table based on info in those two listboxes.

And, need the ability to edit the data in the table and submit to a stored proc to update the database. The editing does not need to be in-line in the table.

I'd like to keep this in one .jsp page but I guess if I have to break it into multiple it's fine but it should be able to be done in one page, right? I'm very familiar with the Microsoft way of VBScript/server-side VBScript but going into JAVA (Macromedia JRun) on the server-side is all new to me. And I certainly miss the IDE from Microsoft with the IntelliSense.

What is a general way to do this or is there a general JavaScript/JAVA tutorial site with an example like this? I haven't found one yet. My biggest issue seems to be in incorporating client-side information into the middle of server-side code (specifically, accessing the listbox value and using that in server-side code).

Help!

BTW, I've been using this article for a starter.
 

MrChad

Lifer
Aug 22, 2001
13,507
3
81
I'm not familiar with JSP specifics, but I've done this a number of times using JavaScript and ColdFusion / ASP. The only way that I know to do what you're asking is to have the form page post back to itself. You can include a hidden form field (e.g. < input type="Hidden" name="Postback" value="true">) that your JSP code checks for. If the postback variable is present, you can use the value for Field1 to filter your SQL query to populate Field2. Then use the rest of the FORM variables to fill in the default values for the rest of your fields (so that the process will appear transparent to the user).
 

conjur

No Lifer
Jun 7, 2001
58,686
3
0
Yeah...I've done that before in .ASP w/VBScript but what I don't know how to do is access the form fields via server-side JAVA. I don't know the commands/properties/methods and the syntax and I can't find a good resource to find that info!

grrr