• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

JSP Question

jgbishop

Senior member
Here is what I want to do (I just don't know which approach is best):

I have an HTML form through which users will make queries about information in an Oracle database. I plan on using JSP to connect to that database (and I know how that is done), but I don't know what the best organizational approach is. What's more, I don't know if some of the approaches are incorrect.

If someone could tell me which of the following is best, I would appreciate it. And, if some of the following don't even work, I'd like to know that too!

Approach 1
Have a static HTML page which collects the data from the user via a form. Send said data (formatted using JavaScript perhaps) to a JSP page, which will do the query and show the results.

Approach 2
Have a JSP page which collects the data from the user via an HTML form and then runs the query. Passes the results to another JSP page (is this possible?) to be shown to the user.

Approach 3
Have a JSP page which collects the data from the user, runs the query, and shows the results (all on the same page). This is the approach I would like to stay away from. For my uses, the query and results should be on separate pages.

What is best here? Are there examples of these kinds of operations (mainly, passing data from one page to another)? Do I need some standalone program running in the background to handle these data pushes?

And and all help is appreciated!
 
Yes, this is just straight up SQL. But I'm not worried about the SQL. I want to be able to pass data from one page to another, using JSP pages and an HTML form. Once I have the data from page 1 on page 2, I can do the SQL stuff.
 
Right, but iSQL*PLus provides a web interface for running SQL queries against an Oracle database. I think it will accomplish exactly what you are looking for without any additional development. It should be included with Oracle.
 
<-- doesn't know crap about Oracle but will offer jsp advice

First off, servlet programming is definitely preferable when talking to a database. If you're doing anything serious I strongly advise you look into it.

That being said, if you don't want the form and the results on the same page (which is good, it's easier that way) then I think you want Approach 1. The form itself needs no server-side brains whatsoever (unless you want to do things like dynamically filling in default values). So the user goes to this page, fills in their data and the browser posts to your jsp (or servlet). You run the query, format the result ... the user sees the result. Then on the results page you have a link back to the form so that they can try again if they wish.

Approach 2 is more or less useless, Approach 3 is what you'd want if you had a one page interface and that could be simplified greatly by combining a jsp (for the display of the form and results) and a servlet (for receiving the form data and talking to the database).
 
Back
Top