JDBC and HTML
Hi everyone,
I am trying to do the following for a project of mine:
1) Open a jdbc connection to a oracle server (already done that)
2) Open a web page so that user can enter some data in a textfield. My pages are currently in .html format.
3) Get user data from the page when user pushes a html button ("Submit" for example.
4) Send user data to database via jdbc (i know how to do that).
So i have problem with steps 2 and 3. I must mention here that i dont want to use php or another scripting language such as javascript. Please tell me if they is a way. I tried opening a JApplet, but no success so far :(.
Please help!!!!
# 4
Nope...
Servlets is another part of the same exercise.
This part must be done using jdbc, html and simple java.
This fact it may be confusing to you. It is a mystery to me too: why my professor (the lesson is called Databases) wanted both servlets and jdbc, in two completly separate parts?.
I just want to skip the painfull procedure of constructing many java frames. Constructing html pages is a lot easier. If i could just connect java to the page and get the data, my problems would be solved :-)
Thanks again,
Message was edited by:
PirateManiac
# 5
No servlets? Since you're supposed to be acting on an HTTP request, perhaps your teacher wanted you to write a web server in Java? It could be done. Or perhaps you're supposed to write a browser that's competent enough to display an HTML form and accept its input?
But anyway, stop making us guess. If you aren't going to tell us the requirements except by saying "Nope" when we guess wrong, we aren't going to get anywhere.
# 6
Well, i have made some progress from last night...:-) Thanks all for helping.
Now a last thing remains to be solved:
I have an Applet called "GetAppletInfo" with a method, lets call it "haha - public void haha() ".
I have an html page lets call it "htmltest.html". I have been able (using javasctipt ) when pussing a button the "GetInfoApplet" applet to be called. Here is my javascript method:
<script language="Javascript">
var _app = navigator.appName;
if (_app == 'Netscape') {
document.write('<embed code="GetAppletInfo.class"',
'width="200"',
'height="200"',
'type="application/x-java-applet;version=1.5.0">');
}
else if (_app == 'Microsoft Internet Explorer') {
document.write('<OBJECT ',
'classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"',
'width="200"',
'height="200">',
'<PARAM name="code" value="GetAppletInfo.class">',
'</OBJECT>');
}
else {
document.write('Sorry, unsupported browser.
');
}
</script>
However this code calles the whole applet to run. I just want when the button is pushed, only one method of "GetAppletInfo" to be called, p.e. the haha method. Is that possible?
Thanks again.
PS. Sorry for making you people guessing. I am just new to this kind of java programming (with web) and my questions may sound a bit silly.
PS2. I know that in my first message i stated not to use javascript. Consider that just a misunderstanding. :P
# 7
I don't think you have grasped the idea of java and the web. You can't simply have a web page working with "straight forward java". You must have some way of calling java. Your basic options are JSP, servlets or applets. you could always write your own web server like someone suggested, but judging from your knowledge i would stay well clear. You need to pick one of those options and come up with a solution.
All three can create a JDBC connection. You need to determine which one you want and how to pass in the data. In all cases you could have an HTML form that collects and submits the data.
Ted.