Yes, the server support JSP. So, do you mean JSP is a good choice
and not necessary to mix use of other language?
Yes, yes (although XSLT will still be useful, and you may have
client-side JavaScript)
r u considering the load of the server if i use JSP?
No, I am considering two things;
- XML isn't a database. Query operations to retrieve a subsection are
poor and inefficient. Filtering out a large proportion by some
tree-structured criterion isn't so bad ("return all elements where
their children have more children than their grandparents" etc.), but
a simple retrieval "Give me test #42" is inappropriate.
- More importantly (for storage anyway). XML isn't atomic. The unit
of atomicity (smallest thing you modify in one operation) for a
database is the row (sic). In XML it's the entire _document_, because
it needs to be changed in the DOM, then stored back on disk to make it
persistent. This becomes very awkward for many simultaneous changes,
and a web application almost guarantees this.
And, i do want to put all the information within one
<question></question> element, including questiontext, possibleanswer,
and correct answer. any problem with this?
This is a terrible way to structure things !
Produce a schema to describe questions; either find one or write it
yourself.
I would build one represented a <test> element that contained three
things: <question> - Question and possible answers or hints,
<model-answer> - the real answer, and also <user-answer> - the user's
actual answer. There would also be elements to manage lists of these
questions as an <exam>.
Remember that you might also want to include test instructions etc. in
the exam. Where text is required, I'd allow the same elements as
XHTML, either by namespacing or by simply copying them. _Definitely_
permit the %coreattrs; attributes on each of these elements (title,
id, style, class).
I would then build XSLT stylesheet(s) that rendered an <exam> into
XHTML. There may be parameters (or separate sheets) to control whether
the model-answers or user-answers appear or not. Such stylesheet(s)
can be used to print test papers, to give astudent hints as they
progress, or even to mark and totalise the finished exam.
Assume for a moment that each <exam> uses separate <question>s from
every other exam (sharing them adds a little complexity to the
database).
I would store each <exam> in my SQL database, as either a text field
filled with XML, or as separate fields for each <test> (probably
better, and not much harder to query). This database contains the
<question> and <model-answer> components for each <test>, and the set
of <test>s that go to make up an <exam>.
A separate database table(s) records the <user-answer>s as they are
entered.
I worry about if the users (with different Browser and different
operating system) can access my webpage.
Your finished page should be very simple standards-compliant XHTML. It
might offer JavaScript to "enhance" use, but it shouldn't depend on
such things and I don't think it will need to.
It can display in IE,but not in Netscape or Opera.
Fix it to work in both. Render all XML into HTML on the server, then
supply this to the browsers. If it's not then browser-compatible, fix
the JavaScript until it is. You're not doing a complex problem here -
browser incompatibility with a "mainstream" browser is inexcusable
today.
You could also supply XML to the client browser, and use XSLT on the
browser to turn it into HTML. This would be a good way to build an
interface and because it's "fun technology", many developers would
jump at it. DO NOT DO THIS !
It will be hard to make it work on browsers other than IE. More
importantly, it may involve the <model-answer>s also being supplied to
the client browser (as XML) and that is insecure.
Students lie, cheat and copy answers like crazy.
DO NOT TRUST THEM.