How data can be transmited between a webpage and a file
2 posts in topic
Flat View  Flat View

Posted By:   siddhartha_pvrk
Posted On:   Wednesday, February 7, 2007 05:07 AM

I want 2 store data from any web page inti the database.Database may be sql,ms-acess or ms-excel.How i can write the code for that one? Please send me the code.That will help me in my final year project.It's urgent.

Re: How data can be transmited between a webpage and a file

Posted By:   Robert_Lybarger  
Posted On:   Wednesday, February 7, 2007 09:01 PM

Here's an outline. No code, but this will save you some effort, so saying 'thanks' would be polite:

(1)have a relatively recent JDK. 1.5 or 1.6. set an environment variable "JAVA_HOME" pointing to the top of where you install this.

(2)download and install apache tomcat. start the service and point a browser to http://localhost:8080 and be sure you get the default greeting page.

(3)download and install mysql (non-commercial version). be sure you have some account ('root' or otherwise) that can successfully login. Actually login, change to the 'test' database, create a table, add values to it, do a basic select query, and exit.

(4)download the mysql/J connector and drop it into tomcat's common/lib (or shared/lib???) directory.

(5)read tutorials about JDBC and mysql -- create a standalone application whose sole job is to successfully connect to the database, query, add value(s), etc. There is a lot to sort out here. If you jump directly into servlet code at the same time, you don't stand a chance figuring out just where the configuration glitches all are.

(6)read a lot of stuff about j2ee.

(7)create a static html page with a text input box and a submit button which does a POST to a servlet you'll write.

(8)write the servlet -- you'll need to have your compiler or IDE reference some jar files tomcat provides in its common/lib (such as servlet-api.jar). The servlet will need a doPost method override. You'll want to use request.getParameter to access the submitted form variable. Build off the code you wrote in (5) to interact with the database. Make note of response.getWriter (?) to "draw" an HTML response back to the client browser to indicate success/failure and/or show what rows are in the db.

(9)read about tomcat (server.xml) configuration so it knows to call your servlet code when a given url is requested from the browser's "post" action.

(10)(re)start mysql and tomcat, and point your browser to your static web page. enter values, click submit button. good luck debugging.

If you survive, congratulations. This is a lot of work when you are trying to learn all the different parts at the same time. One can only hope you haven't waited until the last minute, or (again) you don't stand a chance here.

Re: How data can be transmited between a webpage and a file

Posted By:   WarnerJan_Veldhuis  
Posted On:   Wednesday, February 7, 2007 05:41 AM

Few things:

1) This is not urgent. Having diarrea with no toilet in sight, THAT is urgent. Your question is not more urgent than another people's question. Conclusion: that was rude.

2) Nobody is going to send you the code. Do the work yourself. I am not going to make your final school project for you. If you can't do it, you will fail miserably, and probably have chosen the wrong course. Start practicing the line "do you want fries with that?". Not everybody is IT-material.

3) There are a lot of components involved in the problem you describe. For example: you need the following:

a) a webserver for serving the JSP pages

b) an application server to run your servlets

c) a database, being SqlServer, Oracle, Access, MySQL, but not Excel. Excel is not a database.

d) The code is not exactly a one-liner. It needs a few classes to be designed.

Fortunately, a + b can be combined in a program called JBoss, WebSphere, WebLogic, hell, only Tomcat would work even as well in this case. You can download all of these, where Jboss and Tomcat are free. THen you would go to Sun's site and read the J2EE tutorial a bit. Especially the past about servlets and JSP.

All the databases, except Access, are downloadable as well. Get your hands on one of these. Then start studying JDBC.

Now go and practice. I have studied very hard to get where I am now. And it pays off. I don't let anybody do my work for me. If that is your thing, you should go into managment.
About | Sitemap | Contact