user guide |
- welcome to qjsp
- questionnaire definition
- css support
- actions
- Change the displayed texts in the jsp pages
welcome to qjsp
qjsp is a java j2ee server sided application. It is used to do online questionnaires via the intra/ internet. Therefore, you first have to create a questionnaire file. This is a file which contains the questions and is written in xml using a special xml schema (xsd). This a quite easy task, with a good xsd-aware editor and a little training even an un experienced user should be able to do that.
Those questionnaire files are moved to the server. The server provides a user
management (e.g. create user, log them in and out, ..., those information are
stored in a xml file). After login in, the the questionnaire is transformed
into plain html code and presented to the user.
The user now answers the questions, and, after the questions are completely
answered, the result a saved into a result xml file.
Beside the standard java j2se 1.4 and j2ee 1.4beta libraries, following components
are used:
apache jakarta struts 1.2 for the web framework (provides a clear and easy
design)
saxon 7.1 for xslt transformations
WebMacro as template engine for presenting the questionnaires
sun jaxb for xml binding to the user db.
questionnaire definition
The qjsp system is able to handle numerous questionnaires. To create your own questionnaire, you have to write a xml file describing the structure and the questions you want to have. Each questionnaire source file has to follow the questionairexml.xsd.
After that, you have to save the questionnaire into the /qjsp/WEB-INF/quest folder. When requested the first time, the questionnaire will be initialized by the system
Note: There may be problems with non-standard characters (e.g. language specific chars like ä,ö,ü,ß,...).
Please refer the schema documentation documentation of questionairexml.xsd
A simple questionaire file with one question could look like this:
<?xml version="1.0" encoding="UTF-8"?>
<questionaire xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="questionairexml.xsd">
<name>Studienkurzfragebogen</name>
<description>Dieser Fragebogen erfasst eine Kurzzusamenfassung der Studiensituation.</description>
<author>
<firstname>Christoph</firstname>
<name>Lofi</name>
</author>
<date>2003-12-12</date>
<styleSheet>questionairestyle.css</styleSheet>
<questionaireForm>
<page>
<block>
<blockID>Block1</blockID>
<questions>
<qFreetext>
<questionText>qFreetext: Please enter an arbitary freetext:</questionText>
<ID>freetext</ID>
</qFreetext>
</questions>
</block>
</page>
</questionaireForm>
</questionaire>
css support
You can provide own css files. Those files have to be stored in the /qjsp/
root directory. When specifying a css in a questionnaire xml, enter only he
filename including the extension.
Following styles should be contained in a css for qjsp:
-
body
Used for the normal text and backgrounds.
-
h1
That's the style of the page headlines.
-
h2
Used for block headlines.
-
h6
Small font for footer annotations.
-
.error
Style used for error messages. A smaller font with an other color should be used.
-
.optional
Style used for the "question is optional" message.
-
.questText
That's the style used for displaying the question text (question itself, additional info, ...)
-
.statementheader
This style is used for the scale of statement questions (also for YesNo, SemDiff, Select, ...)
-
.statementText
This style is used for the single text labels in statement questions (also for YesNo, SemDiff, Select, ...)
-
.invisibleText
Indicates text that should be invisible (so, the same color as the background).
actions
Actions are called with the relative url /do/"actionname" in a web browser.
There are different actions, separated in two classes: those, which the user
can call in his url
and those which are used by the system.
You can provide the system with a parameter named "quest" which contains the name of the questionnaire to be displayed (only the name, no path or extensions).
user callable actions
showLogin
shows the login screen. If there is a user cookie stored, the cookie information's will be used to fill the login jsp. You have the option to specify a quest in the request. If you don't do that, there will be an input field in which the user can specify his questionnaire.
Example:
http://<qjsp_server>:<server_port>/qjsp/do/showLogin?quest=quest_test
or
http://<qjsp_server>:<server_port>/qjsp/do/showLogin
showUnilogin
shows the unilogin screen. Behavior matches that of showLogin.
In difference to the standard login, the unilogin allows to create a new user automatically. So, if you enter the login parameters of an existing user, the user will be logged in. If the login parameters don't fit to an existing user, it is tried to create a new one with those parameters.
showNewUser
shows the screen for new user creation.
urlLogin :
Tries to login a user with url parameters. Therefore, there have to be the
parameters
"username", "passwd" and "quest" have to be
provided in the request.
Example request is quite similar to uniLogin.
uniLogin :
Tries to login a user with url parameters. Therefore, there have to be the
parameters
"username" and "passwd" provided in the request. If the
parameters are a valid login, the login action is called. If not, it is tried
to create a new user according to the parameters. If that's unsuccessful too,
the request will be forwarded to the requestNewUser screen.
Example:
http://<qjsp_server>:<server_port>/qjsp/do/unilogin?username=xyz&passwd=123&quest=q_demo
This tries to login a user named xyz with the password 123. If that's not possible (e.g. a user with the password does not exist), a new user is created with that name and password. If the creation was successful, the questionnaire quest_test.xml in the qjsp/WEB-INF/quest directory will be displayed.
This action is also used by the system with special objects in the request scope.
system callable actions
newUser:
Creates a new user after the newUser form was filled out successful.
login:
Logs a user into the system after confirming the input either from the login form or a urlLogin action. Writes a user cookie which can be used form showLogin.
present:
Displays a questionaire. Therefore, the user have to be logged in and a session attribute named "quest" containing the name of the questionaire to be displayed has to be there.
evaluate:
This action is called when posting an input of a questionaire. It tries to validate the input and redisplays the questionnaire, if needed. If everything is OK, the result will be saved.
Change the displayed texts in the jsp pages
You can customize the texts displayed in the jsp pages before showing the questionaire (login, registration, ...). To do so, you need to alter the files
ApplicationResources_de.properties for the german version or ApplicationResources.properties for the english version.
You can do that either directly in your unpacked webapp in the application server (search for the files) or in the sources of the source distribution (refer developpers guide).