jsp problems, only one part of code executes

Rogelio Trist�n

Greenhorn

Posts: 4

posted 12 years ago

okay the code is supposed to make a table and display student names from the student table, and then afterwards have some text boxes to enter the student name you want to edit, then the new student info (new name and new id number)... well when I execute it, it will show a form for asking wwhat data to update, but it completely skips the first part of the code that sets a table to display the list of students...... funny thing is, when I delete the part about asking for student update info, it will show the list of students... why will it only do the second part of the code when I have them both? how do I make it both show all students in the database, AND ask for student info to update at the bottom ? thanks guys I appreciat it

Rogelio Trist�n, Whenever you post more than a line or two of code, you should wrap them in the UBB Code tags (there is a button to generate them on the reply screen). These tags will preserve your code's indenting -- making it easier for others to read. This, of course, makes it more likely that someone will actually read it and thus, makes it more likely that you will get help.

You did. I see them there now. Not sure how I missed them. I apologize.. profusely

There are a lot of little things that could be giving you trouble Such as improper xml syntax:

and submit tags that are not within the HTML form tags:

Also, within your form, I don't see any input fields at all so I'm not sure how they could be showing:

and within that form there is a table without any TD or TR tags.

There may be another small syntax error that is preventing your table from rendering. Try looking at the HTML source to see if it is being printed to the page but not rendered due to an HTML bug.

The above points are, for the most part, nitpicking.There is one very serious problem with this code that I want to point out:

Whenever you declare variables like this:

you're creating what are called instance variables. Variables declared this way are not thread-safe. They are shared by all requests being processed by your JSP and will lead to major concurrency issues if not fixed. Unless you have a pressing need to do this and know exactly what you're doing, you should avoid it. Declare all of your variables inside the JSPs service method by not using the <%! operator. [ May 14, 2005: Message edited by: Ben Souther ]