Contact: Tel: 2726 - New Media Systems, 1st Floor South, Queens Walk
Kalyan
Looks at your XML it IS simple, but I guess the question can be changed and the
generation of your questions can be random, did I guess right?
Choose the right tools to do the right thing is very important at the design
stage. Good decision is based on good understanding of the business problem. As
for you, if the question is always the same, you might just use HTML. Otherwise,
I can see a quite typical example of client-server model here:
1. Tier-1: the database:
store your questions and associate the choices plus the right
answer in a relational database;
2. Tier-2: Server side:
write a servlet that upon receiving request from the client,
connect to the database and generate a dynamic page containing
random number of questions and the choices embeded in a form;
writing another servlet or using the same servlet above to process
the result request from the same client and store the result in the
database.
3. Tier-3: Client side:
using the JavaScript to process the user choices and when the user
hit finish button (or whatever name of your choice),send the result
as a form request to the servlet.
For the Tier-2, you can use JSP but then you sould also employ JavaBeans because
the JSP works best with those beans. For simple and quick application I would
prefer servlet as it is simple and easy and straightforward, therefore easy for
maintenance and support. If you predict that your application may grow in near
future to some larger scale, try JSP. This means you write some beans to
maintain database connections, to do the database query and to store the query
result. Your servlet simply generates a JSP file (which can be based on a
pre-made template) and dispatch it to the server. The JSP access the beans to
get the question and the choices, embed them into a nicely formated HTML code.
To make this model more academic and thoretically sound, we named this model
MVC, where the JSP is the "view", the beans are the "Model", and the servlet is
the "controller".
On the XML side, your servlet can read the question and its assoicated choices
from the database and build up an XML DOM object. Using this object you can then
generate the XML file and embed it into the HTML code (servlet approach). if you
use JSP, use the beans to generate the DOM object instead, and then the JSP file
will be able to use that object directly, without even generate the XML file. I
would usually restrict the use of XML on the server side. Althou you can use it
on client side as well, however, you need to be aware that not all the clients
have the XML DOM API installed and therefore you may run into problems of either
long time downloading or complicated client configuration.
Obviously I may have not given you enough details but hopefully you will have a
start point.
Cheers,
Charles
kalyan inuganti <[EMAIL PROTECTED]> on 10/16/2000 06:48:48 AM
To: [EMAIL PROTECTED]
cc: (bcc: Charles Chen/YellowPages)
From: kalyan inuganti <[EMAIL PROTECTED]>, 16 October 2000, 6:48 a.m.
Thanks Charles! More help..please [Scanned by Yellow Pages PostMaster]
Hi Charles!
Thank you very much for the code snippet. I was kind of getting worried about
where and how to start since I do not have many resources here except for
people like you on the mailing list.
I have one basic question since I am not sure of what would be the most
efficient thing to do. I want to know what kind of resources I should utilize
for what I am trying to develop. please suggest as it will be very valuble.
Here is what I want to do:
I have an XML document on the server like the one below:
<?xml version="1.0" ?>
<quiz>
<question1>
which one of the following statements is true?
<choice1>India won against NewZealand</choice1>
<choice2>India lost in the finals</choice2>
<choice3>The game was cancelled</choice3>
</question1>
<question2>
When did the 2nd world war come to an end?
<choice1>1945</choice1>
<choice2>still going on</choice2>
<choice3>none of the above</choice3>
</question2>
</quiz>
This quiz should look like any other online quizes. There should be radio
buttons for the options and there should be client side processing as well to
avoid burden on server. say if the student gets 1 out of the 2 answers correct
then the score should be like 5/10 and this score needs to be sent to the
server. How can I come up with something like that?
Do I need to use a servlet to send the quiz to the client and how can I come
up with the client side processing? Can I use JSP? There was one other
gentleman that suggested that I better use JSP because it is more efficient. I
know nothing about JSP right now but I can work on it.
(The client side processing thing is a requirement in my project
specification)
Any suggestions in this regard will be greatly appreciated. The essence of the
project needs to be "portable data (XML) and portable code (Java).
Thank you,
Kalyan
____________________________________________________________________
Get free email and a permanent address at http://www.netaddress.com/?N=1
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html