|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.servlet.jsp.tagext.TagSupport cmu.survey.jsp.tags.TagSupportAndMore cmu.survey.jsp.tags.DatabaseList cmu.survey.jsp.tags.DatabaseUpdate
public class DatabaseUpdate
A subclassable tag for inserting, updating and deleting records from a database. It reads the information straight from the form in the request object, if a form was submitted.
GenericUpdate
is a more generic subclass of DatabaseUpdate.
If you are using the <survey:
tag, you won't need to use either of these -- GenericUpdate is automatically called from the Survey tag.
Survey
>
Field Summary | |
---|---|
protected int |
currentMode
|
protected static int |
dbDelete
|
protected static int |
dbInsert
Some constants for the mode we are in |
protected java.lang.String |
dbTable
The name of the table we are changing |
protected static int |
dbUpdate
|
static java.lang.String[] |
monthArray
A (handy) array of month names |
protected javax.servlet.http.HttpServletRequest |
theRequest
The request object from the page |
static java.lang.String[] |
weekdayArray
A (handy) array of weekday names |
protected java.lang.String |
whereClause
The string that will uniquely identify the record |
Fields inherited from class cmu.survey.jsp.tags.DatabaseList |
---|
auxResultSet, databaseConnection, field, fieldsToShowArray, out, queryObjectName, resultSet, returnMessage, select, theConnection |
Fields inherited from class cmu.survey.jsp.tags.TagSupportAndMore |
---|
dateFormatAmerican, dateTimeFormatAmerican, DAYS_OF_THE_WEEK, debug, MONTHS_OF_THE_YEAR, timeFormatAmerican |
Fields inherited from class javax.servlet.jsp.tagext.TagSupport |
---|
id, 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 |
Constructor Summary | |
---|---|
DatabaseUpdate()
|
Method Summary | |
---|---|
java.lang.String |
assembleDate(java.lang.String theMonth,
java.lang.String theDay,
java.lang.String theYear)
Takes the names of 3 paramaters, grabs them from the request and returns them stuck together with slashes between them. |
java.lang.String |
assembleDateSQL(java.lang.String theMonth,
java.lang.String theDay,
java.lang.String theYear)
|
protected void |
cleanExecute(java.lang.String SQLstring)
Appends the where clause and executes the query |
int |
doStartTag()
|
protected java.lang.String |
fixSQLString(java.lang.String aStringParam)
Fixes a string for insertion into a database - removes apostrophes ("'") Use fixSQLString2 to remove semicolons too, whenever possible. |
static java.lang.String |
fixSQLString2(java.lang.String aStringParam)
Fixes a string for insertion into a database - escapes apostrophes and backslashes. |
protected void |
initAttributes()
|
protected static java.lang.String |
nullEmpty(java.lang.String theParameter)
This function takes a string and returns the string "null" if it is empty. |
void |
reinit()
|
Methods inherited from class cmu.survey.jsp.tags.TagSupportAndMore |
---|
breakDownToArray, convertDayNameToNum, convertDayNumToName, convertDayNumToName, convertMonthNumToName, doCatch, doFinally, formatDateTimeViewable, formatDateTimeViewable, formatDateViewable, formatTimeNoSecondsViewable, formatTimeNoSecondsViewable, formatTimeNoSecondsViewable, getNumDaysInWeek, parseTimeNoSecondsFromViewable, print, 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 |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String dbTable
protected java.lang.String whereClause
protected static final int dbInsert
protected static final int dbUpdate
protected static final int dbDelete
protected int currentMode
protected javax.servlet.http.HttpServletRequest theRequest
public static final java.lang.String[] monthArray
public static final java.lang.String[] weekdayArray
Constructor Detail |
---|
public DatabaseUpdate()
Method Detail |
---|
protected void initAttributes()
public int doStartTag()
doStartTag
in interface javax.servlet.jsp.tagext.Tag
doStartTag
in class DatabaseList
protected void cleanExecute(java.lang.String SQLstring)
protected static java.lang.String nullEmpty(java.lang.String theParameter)
protected java.lang.String fixSQLString(java.lang.String aStringParam)
public static final java.lang.String fixSQLString2(java.lang.String aStringParam)
public java.lang.String assembleDate(java.lang.String theMonth, java.lang.String theDay, java.lang.String theYear)
public java.lang.String assembleDateSQL(java.lang.String theMonth, java.lang.String theDay, java.lang.String theYear)
public void reinit()
reinit
in class DatabaseList
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |