|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opencms.jsp.CmsJspBean
org.opencms.jsp.CmsJspActionElement
org.opencms.frontend.templateone.form.CmsFormHandler
public class CmsFormHandler
The form handler controls the html or mail output of a configured email form.
Provides methods to determine the action that takes place and methods to create different output formats of a submitted form.
| Field Summary | |
|---|---|
static java.lang.String |
ACTION_CONFIRMED
Request parameter value for the form action parameter: correct the input. |
static java.lang.String |
ACTION_CORRECT_INPUT
Request parameter value for the form action parameter: correct the input. |
static java.lang.String |
ACTION_SUBMIT
Request parameter value for the form action parameter: form submitted. |
static java.lang.String |
ATTRIBUTE_FILEITEMS
Name of the file item session attribute. |
static java.lang.String |
ERROR_MANDATORY
Form error: mandatory field not filled out. |
static java.lang.String |
ERROR_VALIDATION
Form error: validation error of input. |
static java.lang.String |
PARAM_FORMACTION
Request parameter name for the hidden form action parameter to determine the action. |
| Fields inherited from class org.opencms.jsp.CmsJspActionElement |
|---|
NOT_INITIALIZED |
| Constructor Summary | |
|---|---|
CmsFormHandler(javax.servlet.jsp.PageContext context,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Constructor, creates the necessary form configuration objects. |
|
CmsFormHandler(javax.servlet.jsp.PageContext context,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
java.lang.String formConfigUri)
Constructor, creates the necessary form configuration objects using a given configuration file URI. |
|
| Method Summary | |
|---|---|
java.lang.String |
convertToHtmlValue(java.lang.String value)
Replaces line breaks with html <br>. |
java.lang.String |
convertToPlainValue(java.lang.String value)
Replaces html <br> with line breaks. |
java.lang.String |
convertValue(java.lang.String value,
java.lang.String outputType)
Converts a given String value to the desired output format. |
java.lang.String |
createHiddenFields()
Returns the configured form field values as hidden input fields. |
protected java.util.List |
createInternetAddresses(java.lang.String mailAddresses)
Creates a list of internet addresses (email) from a semicolon separated String. |
protected java.lang.String |
createMailTextFromFields(boolean isHtmlMail,
boolean isConfirmationMail)
Creates the output String of the submitted fields for email creation. |
java.util.Map |
getErrors()
Returns the errors found when validating the form. |
CmsForm |
getFormConfiguration()
Returns the form configuration. |
org.opencms.i18n.CmsMessages |
getMessages()
Returns the localized messages. |
java.util.Map |
getParameterMap()
Returns the map of request parameters. |
boolean |
hasValidationErrors()
Returns if the submitted values contain validation errors. |
void |
init(javax.servlet.http.HttpServletRequest req,
java.lang.String formConfigUri)
Initializes the form handler and creates the necessary configuration objects. |
boolean |
isInitial()
Returns if the form is displayed for the first time. |
void |
sendConfirmationMail()
Sends the confirmation mail with the form data to the specified email address. |
boolean |
sendMail()
Sends the mail with the form data to the specified recipients. |
protected void |
setErrors(java.util.Map errors)
Sets the errors found when validating the form. |
protected void |
setFormConfiguration(CmsForm configuration)
Sets the form configuration. |
protected void |
setInitial(boolean initial)
Sets if the form is displayed for the first time. |
protected void |
setMessages(org.opencms.i18n.CmsMessages messages)
Sets the localized messages. |
boolean |
showCheck()
Returns if the optional check page should be displayed. |
boolean |
showForm()
Returns if the input form should be displayed. |
boolean |
validate()
Validation method that checks the given input fields. |
| Methods inherited from class org.opencms.jsp.CmsJspActionElement |
|---|
editable, editable, editable, editableManualClose, editableManualOpen, getContent, getContent, getMessages, getMessages, getMessages, getMessages, getNavigation, getNavigationUri, img, img, include, include, include, include, include, include, includeSilent, includeSilent, includeSilent, includeSilent, info, label, link, link, properties, properties, property, property, property, property, template, template, template, toAbsolute, user |
| Methods inherited from class org.opencms.jsp.CmsJspBean |
|---|
getCmsObject, getController, getJspContext, getMessage, getRequest, getRequestContext, getResponse, handleException, init, isNotInitialized, isSupressingExceptions, setContentType, setStatus, setSupressingExceptions |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String ACTION_CONFIRMED
public static final java.lang.String ACTION_CORRECT_INPUT
public static final java.lang.String ACTION_SUBMIT
public static final java.lang.String ERROR_MANDATORY
public static final java.lang.String ERROR_VALIDATION
public static final java.lang.String PARAM_FORMACTION
public static final java.lang.String ATTRIBUTE_FILEITEMS
| Constructor Detail |
|---|
public CmsFormHandler(javax.servlet.jsp.PageContext context,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws java.lang.Exception
context - the JSP page context objectreq - the JSP requestres - the JSP response
java.lang.Exception - if creating the form configuration objects fails
public CmsFormHandler(javax.servlet.jsp.PageContext context,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
java.lang.String formConfigUri)
throws java.lang.Exception
context - the JSP page context objectreq - the JSP requestres - the JSP responseformConfigUri - URI of the form configuration file, if not provided, current URI is used for configuration
java.lang.Exception - if creating the form configuration objects fails| Method Detail |
|---|
public java.lang.String convertToHtmlValue(java.lang.String value)
value - the value to substitute
public java.lang.String convertToPlainValue(java.lang.String value)
value - the value to substitute
public java.lang.String convertValue(java.lang.String value,
java.lang.String outputType)
The following output formats are possible:
value - the String value to convertoutputType - the type of the resulting output
public java.lang.String createHiddenFields()
public java.util.Map getErrors()
public CmsForm getFormConfiguration()
public org.opencms.i18n.CmsMessages getMessages()
public boolean hasValidationErrors()
public void init(javax.servlet.http.HttpServletRequest req,
java.lang.String formConfigUri)
throws java.lang.Exception
req - the JSP requestformConfigUri - URI of the form configuration file, if not provided, current URI is used for configuration
java.lang.Exception - if creating the form configuration objects failspublic boolean isInitial()
public java.util.Map getParameterMap()
public void sendConfirmationMail()
throws java.lang.Exception
java.lang.Exception - if sending the confirmation mail failspublic boolean sendMail()
If configured, sends also a confirmation mail to the form submitter.
public boolean showCheck()
public boolean showForm()
public boolean validate()
All errors are stored in the member m_errors Map, with the input field name as key and the error message String as value.
protected java.util.List createInternetAddresses(java.lang.String mailAddresses)
throws javax.mail.internet.AddressException
mailAddresses - a semicolon separated String with email addresses
javax.mail.internet.AddressException - if an email address is not correct
protected java.lang.String createMailTextFromFields(boolean isHtmlMail,
boolean isConfirmationMail)
isHtmlMail - if true, the output is formatted as HTML, otherwise as plain textisConfirmationMail - if true, the text for the confirmation mail is created, otherwise the text for mail receiver
protected void setErrors(java.util.Map errors)
errors - the errors found when validating the formprotected void setFormConfiguration(CmsForm configuration)
configuration - the form configurationprotected void setInitial(boolean initial)
initial - true if the form is displayed for the first time, otherwise falseprotected void setMessages(org.opencms.i18n.CmsMessages messages)
messages - the localized messages
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||