Forums Register Login

simple questions

+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
are you asking that someone do this project for you by giving you the answer? It sounds like you were assigned to do something on your own but you do not want to do it yourself.
+Pie Number of slices to send: Send
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.

You can start learning about JDBC in the Java Tutorial, and about servlets in chapter 3 of the J2EE Tutorial.
+Pie Number of slices to send: Send
The task can be acheived thru any thing.

Eitehr applets or Jsp or servlets.

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 ]
+Pie Number of slices to send: Send
Jetendra Ivaturi, please do not encourage people to take the conversation out of the forums. Please read this for more information.

Also, "abt" is not a real word. Please ue only real words like "about" when posting to the forums. Please read this for more information.
[ August 03, 2007: Message edited by: Bear Bibeault ]
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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.

Fair.

I have few questions though very primary for the experts but crucial for me :

(1) Now in all this applet servlet transaction what is the role of jsp ?
(2) if i use jsp, then will i not have to use applet?
(3) Whether a jsp can accept data from the client and without servlet fetch the data from the database ? or
(4) whether a jsp accepts the data from the client and sends a request to the servelet and gets the data to display to the client from servelet ?
(5) in this scenario what is the role of javascript i.e. what does it does ? (6) is javascript a substitute for applet ?
(7) as the data is in sqlserver database they are using IIS. Whether we can talk to IIS ?

kindly try to give pointwise reply. It would be very helpful.
Thanks.
+Pie Number of slices to send: Send
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.

Doing your GET and POST operations to a servlet is a natural, because a servlet is all Java, no HTML or JavaScript. It gets request fields out of the Request object and executes a POJO. "Plain Old Java Object" just means it doesn't import any servlet, JSP or HTTP stuff. It can call JDBC or whatever else it needs to do to get the data and return the data to the servlet. The servlet forwards to the JSP, which is all about HTML and little or ideally no Java. The JSP builds the response HTML.

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?
+Pie Number of slices to send: Send
yes it is quite useful.
Thanks.
if you think brussel sprouts are yummy, you should try any other food. And this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1077 times.
Similar Threads
hibernate.cfg.xml required in version 2.x?
selecting focus on load
Calling WebService from a simple java class
JSP access to web service sunctionality
What is a Session?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 03:50:17.