...
- Download page1.jsp and change the nextPage variable to random.jsp (see Code Example 1 below). For help with uploading or downloading see here.
- Save page1.jsp as page2.jsp and repeat for page3.jsp.
- Change the pageName parameter in page2.jsp to "Page 2"
- Then change the nextPage variable to "random.jsp" (see code example 2 below)
- Change the pageName parameter in page3.jsp to "Page 3"
- Then change the nextPage variable to "random.jsp" (see code example 3 below)
- Then upload all thee pages.
Code Block |
---|
borderStyle | solid |
---|
title | page1.jsp | borderStyle | solid |
---|
|
<%@include file="include_questionnaire.jsp"%>
<survey:surveypage
pageName="Page 1"
pageWidth="600"
nextPage="random.jsp"
submitButtonText="Next"
showSubmitButton="true"
timeResponses="false"
rememberPageUserIsOn="true"
pageToLoginTo="index.jsp"
tableToVerifyLoginTo="Users"
isLoginPage="false"
/>
<%@include file="survey_end.jsp"%>
|
Code Block |
---|
borderStyle | solid |
---|
title | page2.jsp | borderStyle | solid |
---|
|
<%@include file="include_questionnaire.jsp"%>
<survey:surveypage
pageName="Page 2"
pageWidth="600"
nextPage="random.jsp"
submitButtonText="Next"
showSubmitButton="true"
timeResponses="false"
rememberPageUserIsOn="true"
pageToLoginTo="index.jsp"
tableToVerifyLoginTo="Users"
isLoginPage="false"
/>
<%@include file="survey_end.jsp"%>
|
Code Block |
---|
borderStyle | solid |
---|
title | page3.jsp | borderStyle | solid |
---|
|
<%@include file="include_questionnaire.jsp"%>
<survey:surveypage
pageName="Page 3"
pageWidth="600"
nextPage="random.jsp"
submitButtonText="Next"
showSubmitButton="true"
timeResponses="false"
rememberPageUserIsOn="true"
pageToLoginTo="index.jsp"
tableToVerifyLoginTo="Users"
isLoginPage="false"
/>
<%@include file="survey_end.jsp"%>
|
3. Create a new document in you favorite text editor (e.g. Word Pad, SimpleText, etc.) with the following (you can simply copy and paste this) :
Code Block |
---|
borderStyle | solid |
---|
title | random.jsp | borderStyle | solid |
---|
|
<%@include file="include_questionnaire.jsp"%>
<%
if (redirectRandomOrderTo("Users", "RandomPageOrder", new String[]{"page1.jsp", "page2.jsp", "page3.jsp", " })) {
} else {
redirectTo("doneWithSurvey.jsp");
}
%>
<%@include file="survey_end.jsp"%>
|
...
5 Testing. Open up your survey on the web, and log in. Run through each of the pages until the survey ends. You may need to do this more then once to see the randomization effect. This is especially true of the other types of randomization such as redirectToRandomOrderAndBalanced.
...
A more complex example: Randomizing multiple measures with multiple pages
(I call this "nested randomization")
...
- Repeat step 1 in the first example in the Web Survey Toolkit GUI until you have 3 measures, consisting of 3 pages each - pages 1-9. Name each page, Page 1, Page 2, Page 3, etc. in the Survey Manager.
- Additionally, create a header in the Web Survey Toolkit GUI for each survey page noting their group and page number so we can test our results. For example, Measure A, Page 1; Measure A, Page 2 etc. and number each question 1-30 inside the question text.
- Repeat step 2 in the first example until all 9 jsp pages are created. However, in pages 4-6 change nextPage to random1.jsp, and in pages 7-9 to random2.jsp.
Code Block |
---|
borderStyle | solid |
---|
title | page4.jsp | borderStyle | solid |
---|
|
<%@include file="include_questionnaire.jsp"%>
<survey:surveypage
pageName="Page 4"
pageWidth="600"
nextPage="random1.jsp"
submitButtonText="Next"
showSubmitButton="true"
timeResponses="false"
rememberPageUserIsOn="true"
pageToLoginTo="index.jsp"
tableToVerifyLoginTo="Users"
isLoginPage="false"
/>
<%@include file="survey_end.jsp"%>
|
Code Block |
---|
borderStyle | solid |
---|
title | page9.jsp |
---|
borderStyle | solid |
---|
|
<%@include file="include_questionnaire.jsp"%>
<survey:surveypage
pageName="Page 9"
pageWidth="600"
nextPage="random2.jsp"
submitButtonText="Next"
showSubmitButton="true"
timeResponses="false"
rememberPageUserIsOn="true"
pageToLoginTo="index.jsp"
tableToVerifyLoginTo="Users"
isLoginPage="false"
/>
<%@include file="survey_end.jsp"%>
|
...
5. To create the random pages follow step 3 in the first example. After the first is created (random.jsp), save it as random1.jsp, random2.jsp, and again as randomMeasure.jsp. The code in your random pages should look like this:
Code Block |
---|
borderStyle | solid |
---|
title | random.jsp | borderStyle | solid |
---|
|
<%@include file="include_questionnaire.jsp"%>
<% /** random.jsp will randomize pages 1-3 **/
if (redirectRandomOrderTo("Users", "RandomPageOrder", new String[]{"page1.jsp", "page2.jsp", "page3.jsp"})) {
} else {
redirectTo("randomMeasure.jsp");
}
%>
<%@include file="survey_end.jsp"%>
|
Code Block |
---|
borderStyle | solid |
---|
title | random1.jsp |
---|
borderStyle | solid |
---|
|
<%@include file="include_questionnaire.jsp"%>
<% /** random1.jsp will randomize pages 4-6 **/
if (redirectRandomOrderTo("Users", "RandomPageOrder1", new String[]{"page4.jsp", "page5.jsp", "page6.jsp"})) {
} else {
redirectTo("randomMeasure.jsp");
}
%>
<%@include file="survey_end.jsp"%>
|
Code Block |
---|
borderStyle | solid |
---|
title | random2.jsp | borderStyle | solid |
---|
|
<%@include file="include_questionnaire.jsp"%>
<% /** random2.jsp will randomize pages 7-9 **/
if (redirectRandomOrderTo("Users", "RandomPageOrder2", new String[]{"page7.jsp", "page8.jsp", "page9.jsp"})) {
} else {
redirectTo("randomMeasure.jsp");
}
%>
<%@include file="survey_end.jsp"%>
|
Code Block |
---|
borderStyle | solid |
---|
title | randomMeasure.jsp | borderStyle | solid |
---|
|
<%@include file="include_questionnaire.jsp"%>
<% /** randomMeasure.jsp will randomize measures A, B, and C **/
if (redirectRandomOrderTo("Users", "randomMeasure", new
String[]{"random.jsp", "random1.jsp", "random2.jsp"})) {
} else {
redirectTo("doneWithSurvey.jsp");
}
%>
<%@include file="survey_end.jsp"%>
|
6. Next download and change the nextPage parameter on your index.jsp file so it points to randomMeasure.jsp. It should look like this:
Code Block |
---|
borderStyle | solid |
---|
title | index.jsp |
---|
borderStyle | solid |
---|
|
//index.jsp code example
<%@include file="include_questionnaire.jsp"%>
<%
/**
To use this type of survey, rename this file from "index2.jsp" to "index.jsp". (The default "index.jsp" automatically moves pages around).
Then, you'll be able to control each page, its details, and where it goes next all in the JSP code in here and on "page1.jsp", etc.
d
**/
%>
<survey:surveypage
pageName="Login"
nextPage="randomMeasure.jsp"
submitButtonText="Start Survey"
showSubmitButton="true"
percentQuestion="60"
rememberPageUserIsOn="true"
retrieveValuesFromDB="false"
createUsersAtLogin="true"
isLoginPage="true"
/>
%@include file="survey_end.jsp"%
|
...