cmu.survey.jsp.tags
Class Question
java.lang.Object
javax.servlet.jsp.tagext.TagSupport
cmu.survey.jsp.tags.TagSupportAndMore
cmu.survey.jsp.tags.QuestionTagStub
cmu.survey.jsp.tags.Question
- All Implemented Interfaces:
- HasErrorInfo, HasErrorInfoAndSaves, QuestionTag, java.io.Serializable, java.lang.Cloneable, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.Tag, javax.servlet.jsp.tagext.TryCatchFinally
- Direct Known Subclasses:
- PlainText, QuestionWithVariable, SubmitButton
public abstract class Question
- extends QuestionTagStub
- implements HasErrorInfoAndSaves
Questions
go inside a set of Survey
tags.
So, for example,
<%@ taglib uri="/WEB-INF/SurveyTags.tld" prefix="survey" %>.
<%survey:survey databaseName="databaseName" table="tableName" >.
<%survey:QuestionType question="Question text" dbField="fieldNameInTableName"/>.
<%/survey:survey>.
Question
is the superclass for all types of Questions
. See the subclasses to use in your Surveys
.
If you specify a databaseName
(in the Survey
tag), table
(in the Survey
tag), and a dbField
(in the Question
tag), the data in that Field in that Table in that Database will be loaded and saved automatically when the page loads and the user submits the form. (This data is processed in GenericUpdate
)
Other parameters you can specify:
helpText="Answer this question with your ____"
. This will add a question mark to the right of the question with a pop-up for help. You can see an example of this on the DropDownQuestion
.
defaultValue="words or number"
. When there is nothing pulled from the database, or when the database field is empty, it will display the defaultValue instead.
- See Also:
- Serialized Form
Fields inherited from class javax.servlet.jsp.tagext.TagSupport |
pageContext |
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag |
EVAL_BODY_AGAIN |
Fields inherited from interface javax.servlet.jsp.tagext.Tag |
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE |
Methods inherited from class cmu.survey.jsp.tags.TagSupportAndMore |
breakDownToArray, convertDayNameToNum, convertDayNumToName, convertDayNumToName, convertMonthNumToName, doCatch, doEndTag, doFinally, formatDateTimeViewable, formatDateTimeViewable, formatDateViewable, formatTimeNoSecondsViewable, formatTimeNoSecondsViewable, formatTimeNoSecondsViewable, getNumDaysInWeek, parseTimeNoSecondsFromViewable, println |
Methods inherited from class javax.servlet.jsp.tagext.TagSupport |
doAfterBody, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
imageDirectory
public static java.lang.String imageDirectory
blankImageLocation
public static java.lang.String blankImageLocation
question
protected java.lang.String question
endQuestion
protected java.lang.String endQuestion
helpText
protected java.lang.String helpText
Question
public Question()
Question
public Question(Survey survey)
getDatabaseQuery
protected DatabaseQuery getDatabaseQuery()
setQuestion
public void setQuestion(java.lang.String questionText)
getQuestion
public java.lang.String getQuestion()
setEndQuestion
public void setEndQuestion(java.lang.String endQ)
getEndQuestion
public java.lang.String getEndQuestion()
setHelpText
public void setHelpText(java.lang.String theHelpHTML)
getHelpText
public java.lang.String getHelpText()
setAutoSubmitWhenFinishedWithThisQuestion
public void setAutoSubmitWhenFinishedWithThisQuestion(boolean autoSubmit)
getAutoSubmitWhenFinishedWithThisQuestion
public boolean getAutoSubmitWhenFinishedWithThisQuestion()
setNumberOfColumns
protected void setNumberOfColumns(int numColumns)
doQuestion
public void doQuestion()
- This is where all of the question related printing and work should go -- it gets called from doStartTag or from RandomizeQuestion if there is some matching going on.
- Specified by:
doQuestion
in interface QuestionTag
printTimeSpentField
public void printTimeSpentField(java.lang.String dbField)
setBackgroundColor
public void setBackgroundColor(java.lang.String backgroundColor)
getOtherQuestionInfoToSave
public java.lang.Object getOtherQuestionInfoToSave()
- Returns:
setOtherQuestionInfoToSave
public void setOtherQuestionInfoToSave(java.lang.Object object)
- Parameters:
object
-
doStartOfQuestion
protected void doStartOfQuestion()
- Adds formatting to the question.
This is automatically called from Question.doStartTag(), so as long as you call super.doStartTag() in any subclasses, you don't need to call this method.
getBackgroundColorHTMLText
protected static java.lang.String getBackgroundColorHTMLText(java.lang.String backgroundColor)
doStartOfQuestion
protected void doStartOfQuestion(java.lang.String backgroundColor)
- Adds formatting to the question.
This is automatically called from Question.doStartTag(), so as long as you call super.doStartTag() in any subclasses, you don't need to call this method.
doMiddleOfQuestion
protected void doMiddleOfQuestion()
- Adds formatting for a new cell in the table.
doEndOfQuestion
protected void doEndOfQuestion()
- Call this at the end of doStartTag() to add formatting.
doEndOfQuestionNoPrinting
protected void doEndOfQuestionNoPrinting()
print
public void print(java.lang.String toPrint)
- Overrides:
print
in class TagSupportAndMore
print
public void print(java.lang.Object toPrint)
saveQuestionInfo
protected void saveQuestionInfo()
- Designed to be overwritten by QuestionWithVariable.
getExtraErrorInfo
public java.lang.String getExtraErrorInfo()
- Overrides:
getExtraErrorInfo
in class QuestionTagStub
getSupplementalErrorInfo
public HasErrorInfo getSupplementalErrorInfo()
- Returns:
setSupplementalErrorInfo
public void setSupplementalErrorInfo(HasErrorInfo info)
- Parameters:
info
-
setID
public void setID(java.lang.Integer id)
- Overrides:
setID
in class QuestionTagStub
getID
public java.lang.Integer getID()
- Specified by:
getID
in interface QuestionTag
- Overrides:
getID
in class QuestionTagStub
reinit
public void reinit()
- Overrides:
reinit
in class QuestionTagStub
clone
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
- Specified by:
clone
in interface QuestionTag
- Overrides:
clone
in class QuestionTagStub
- Throws:
java.lang.CloneNotSupportedException