I am new to web programming. I have got a simple project to make. From an SQL server database, i have to retrieve the marks obtained by students in an exam by sending their roll number and display the student's marksheet. Thats all. Can someone tell me how i can make it. Whether it would require applet, servlet or JSP and what exactly should be done as i am completely new to the web field and this happens to be my first web assignment.
Michael, I think you misread Anands question. He didn't say "please do it for me", he said "please tell me how to do it". Helping members to learn how to do things is what JavaRanch is all about, so I'd say his question is reasonable.
As to the question, neither applets nor JSPs are well suited for database access, so you should be using a servlet. For DB access you'll need to know JDBC, the Java API for accessing databases.
But prefer Jsp's and Servlets. As you said you are new to this. Its a good assignment to do.
Write a class which connects to the database. and using an input tag to take the student no. as input. fetch that input in that class. select * from markstable where stdno="+request.getParameter(std_no);
Display them in table fromat or what ever you like.
do remember abt the dirctory structure of web application.
Even I m sailing in the same ship.Got struck at a place. wtng for the response from mighties. [ August 03, 2007: Message edited by: Bear Bibeault ]
As Ulf pointed out, JSPs are not intended for database access or any other type of processing. They should be used only to render the HTML display as part of a properly structured web application.
Joined: Jul 22, 2007
Thanks for the replies.
I have done a bit of research on the net and i found that an applet can be used to take data from the client and then it can be transferred to the servlet through the output stream which in turn can be fetched by the servlet through the input stream, in servlet we can select the data from the database, serialize the object and send it back to the applet via the output stream which can be read by the applet through the input stream and then the data can be displayed.
I have few questions though very primary for the experts but crucial for me :
kindly try to give pointwise reply. It would be very helpful. Thanks.
I'd avoid an applet because they can be a bit tricky and they're not terribly common in the wild.
This is a pretty common structure:
It seems like a lot of moving parts but each one is well focused and simple.
I showed putting the data in a Request attribute to make it visible to the JSP. There are better ways to do that so the JSP can find and use the object as an ordinary bean. Somebody else will have to chime in with the details.
Does that look useful?
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi