|
|||||||||||||
How To Build A Survey: Using JSPAbout JSP/Java A huge benefit of the survey tool is that using Java and JSP, you can make your survey do almost anything. Branching, advanced branching, randomizing pages, and nearly anything you can think of the logic for is all possible when you edit the you web pages directly. If you want to understand this in depth, it is a good idea that you have some experience in programming, especially programming in Java. Whenever you visit a web site, the URL points to an HTML file on the webserver. So, for example, if this is your survey: The first underlined part of your survey in the image above is the name of your survey, in this case, "test2". The second part is the "JSP File Name", which is "index.jsp". There is a folder, "test2" that holds a bunch of files for your survey, and one of those files is "index.jsp". You can edit this file and change what the page does. You can download and upload these pages in the "Edit Survey" page, under "Upload Survey Files" and "Download Survey Files". See below for how to edit this JSP file and what's in it. You can go to "Edit Survey" and use the "Download Survey Files" or "Upload Survey Files" links to get your JSP files and images. If you don't like this technique, you can also access the files directly, if you administrator will let you. First, you need to find where on your server your web page files are stored. You may wish to contact your system administrator to find out how to access the files, who may have set up a new way of accessing the files. Using The Survey Manager: When you use the survey manager website, and you click "Edit Survey", at the bottom of the window it will tell you the directory where all of your files are stored. Not Using The Survey Manager: If you're not using the survey manager, click "Edit Survey". Near the bottom of the page, it will tell you where on the server the files are stored for this webapp. Usually they'll be inside the folder where you installed Apache Tomcat, in one of these places:
A "JSP" page is similar to an HTML file, except that the file name ends with ".jsp" instead of ".html". And, it's dynamic -- HTML pages don't change when the user visits them, but a JSP page does. Using JSP for the first time in a Survey When you start with a new survey, however, you page won't look quite like this -- every page you go to will be using just index.jsp and no other JSP pages -- you can't easily use JSP in this format. To start using JSP, rename the current index.jsp to something else (say, indexAuto.jsp) and the copy index2.jsp back to index2.jsp. This will start you on the right track to using JSP -- of course, you can always go back by moving indexAuto.jsp back to index.jsp. JSP Commands and TagsIn page1.jsp, there are several commands that create the survey and show the page. Let's go through them one at a time.
This includes another JSP page, the contents of which you can imagine to be "included" directly into this page, as if copied and pasted automatically. The file named "include_questionnaire.jsp" you can see that it includes several other files, and it starts the beginning of a webpage. Similarly, at the end of page1.jsp, you'll see
This does the same thing as the first one, including a bunch of HTML and other things that end up at the bottom of the page. The middle tag will load the survey and the questions that you made in the Survey Editor:
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 are parameters. To see how to use and modify JSP Tags, see the surveypage documentation. For many JSP tags, there is better information in the JavaDocs. You can also find how to do more things in JSP by clicking in the Table of Contents. You can change anything in these JSP files and test them, as you are brave enough, but make sure to make backups. Some files you'll want to stay away from unless you absolutely have to edit them, though. Every time you upgrade the survey through the survey manager to the latest version, it will overwrite many files -- all the files that start with "include_", with "survey_", the "Debugging" files, "PreviewPage.jsp", "InitializeForFirstTime.jsp", the files ending in ".js", and everything in the "WEB-INF" folder. So, if you make changes to these files, you may wish to keep track of what you've done -- so that you can make the changes again if you upgrade. More Information About JSP/Java For more information about using JSP and Java, you may want to try a tutorial or two: JHU JSP Tutorial |
|
||||||||||||