JSP Survey Library           SourceForge.net Logo

How To Build A Survey: Using the surveypage tag

Overview And Example
All Parameters

Overview And Example

The surveypage tag will load the survey and the questions that you made in the Survey Editor:


File: page1.jsp (included in the default survey template)

<survey:surveypage
    pageName="Page 1"

    nextPage="page2.jsp"

    submitButtonText="Next"
    pageWidth="600"

    rememberPageUserIsOn="true"
    pageToLoginTo="index.jsp"
    tableToVerifyLoginTo="Users"
    userIDField="ID"
    isLoginPage="false"

    databaseName="<%=databaseName%>"
    />

This is called a "JSP tag" -- it loads a little program which creates HTML and puts it into the page. The tag's name is "survey:surveypage", shown at the beginning. This loads one page of the survey. The text in the middle is parameters. Let's go through the important ones.

surveypage parameter: pageName

Parameter in page1.jsp

    pageName="Page 1"

Place to edit in Survey Editor
Page Name in Survey Editor

The "pageName" parameter tells you which page in the Survey Editor to use when the repondent visits this web page. So,  when you want a particular JSP  page to load a page that you made in the survey editor, name it in the Survey Editor as shown above, and then change the "surveypage"'s "pageName" to that name.

surveypage parameter: nextPage


Parameter in page1.jsp


    nextPage="page2.jsp"

The "nextPage" parameter tells you which page to go to after this page. The name is the name of the JSP file. So, for example, here after the respondent fills out page1.jsp (which is "Page 1" in the Survey Editor), the respondent will next go to "page2.jsp" (which is "Page 2" in the Survey Editor, if you look inside "page2.jsp").

By using "pageName" and "nextPage", you can create a series of JSP files which will take the respondent through the survey. The rest of the parameters are much less important -- if you only know two parameters, know those two.

surveypage parameters



Parameter in surveypage
What It Does

    pageName="Page 1"
The page to load from the Survey Editor. [more]

    nextPage="page2.jsp"
The next page to go to after this one. [more]

    submitButtonText="Next"
The name of the submit button on the web page. [see in page]

    pageWidth="600"
This is the width of the web page in pixels. So, for example, since some user's screens are 640, the default is 600, to leave some extra space for the scroll bar, window, etc. If your respondents are from a known population and you think they will have at least 800x600 sized screens, you may wish to make this "750" or so, etc. [see in page]

    showSubmitButton="true"
Whether or not to show a button on the bottom of the page, in this case, the "Next" button. Default is true. [see in page]

    timeResponses="false" Whether or not to keep track of how long it takes the user to fill out the page. Note that this is very innacurate, due to the amount of time it takes to load an HTML page. You probably shouldn't use this, because you're unlikely to get good data out of it, but you can try. Default is "false".

    rememberPageUserIsOn="true"
Whether or not to remember the page that the user was last on. This goes in the "Users" table (as set by tableToVerifyLoginTo) in the variable named "CurrentPage", and you can use it to see whether or not people have gotten far into the survey. If it is true and a user logs in to the survey a second time,

    pageToLoginTo="index.jsp"
The login page -- this is usually index.jsp. Whenever a user has not logged in yet, it redirects to the login page. (i.e. the user is not logged in if they don't have a unique ID in the database to know where to save the data -- the user may not actually have manually log in to get this, it can be automatically generated).

    tableToVerifyLoginTo="Users"
The database table that respondents information will be loaded and saved from. "Users" is the default, and we recommend that you leave it that way.

    userIDField="ID"
This is the field in the "Users" table (as set above) and in the "Answers" table that is a unique identifier for each respondent.

    isLoginPage="false" Whether this page is a login page -- e.g. index.jsp has this as "true" and everything else has this as "false".
      createUsersAtLogin="true" or "false" If this is "true", any participants who try to log in can get in, and it will create a new entry for them. If it is "false", only previously entered participants will be able to log in. So, to restrict it to users you have imported, set this to false.

    databaseName="<%=databaseName%>" Do not modify this. It is set automatically for you, and is required to be there. Basically, it points to the database that the data is saved in, which is automatically loaded from WEB-INF/classes/Configuration.properties
More about Building a Survey

 

  Home
Screenshots and Demos
Help
  Installing
Building A Survey Using JSP
surveypage tag
Repeated Measures
Changing Data
Getting Data
Clustering Survey
Java Web Start
Developers
Download
Contributors