|
|||||||||
| 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.CmsTemplateBase
org.opencms.frontend.templateone.CmsTemplateBean
org.opencms.frontend.templateone.CmsTemplateForm
public abstract class CmsTemplateForm
Provides methods to build interactive JSP forms.
| Field Summary | |
|---|---|
static java.lang.String |
MESSAGE_BUNDLE_FORM
Name of the resource bundle containing the localized form messages. |
static java.lang.String |
PARAM_ACTION
Request parameter name for the action parameter to determine if the form has been submitted. |
| Fields inherited from class org.opencms.frontend.templateone.CmsTemplateBase |
|---|
ATTRIBUTE_ORIGINAL_URI |
| Fields inherited from class org.opencms.jsp.CmsJspActionElement |
|---|
NOT_INITIALIZED |
| Constructor Summary | |
|---|---|
CmsTemplateForm()
Empty constructor, required for every JavaBean. |
|
CmsTemplateForm(javax.servlet.jsp.PageContext context,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Constructor, with parameters. |
|
| Method Summary | |
|---|---|
protected abstract java.lang.String |
checkTextsUri()
Returns the text URI from the configuration file and checks the presence. |
java.lang.String |
getConfigPath()
Returns the template configuration path in the OpenCms VFS. |
java.lang.String |
getError(java.lang.String key)
Returns the error message for the specified key or an empty String if no error is present for the key. |
java.util.Map |
getErrors()
Returns the error Map holding the validation errors. |
static java.lang.String |
getFormattedString(java.lang.String inputString,
char sepChar,
int lineLength,
java.lang.String separator)
Returns the input String with line breaks added at the specified separator character. |
java.lang.String |
getFormText(java.lang.String element,
boolean stripHtml)
Returns the content of the specified page element from the defined text page. |
java.lang.String |
getFormUri()
Returns the subsituted link to the JSP form. |
java.lang.String |
getPageTitle()
Returns the title of the recommended page. |
java.lang.String |
getPageUri()
Returns the (not substituted) URI to the page that called the form. |
java.lang.String |
getPageUri(boolean removeParams)
Returns the (not substituted) URI to the page that called the form. |
java.lang.String |
getPageUrl()
Returns the URL of the page to be displayed on the form. |
java.lang.String |
getTextsUri()
Returns the URI of the page containing the texts for the form. |
boolean |
hasValidationErrors()
Checks if the input form has validation errors. |
void |
init(javax.servlet.jsp.PageContext context,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Initialize this bean with the current page context, request and response. |
java.lang.String |
isChecked(java.lang.String fieldValue)
Checks if the given String is true and returns the "checked" attribute for checkboxes and radiobuttons. |
boolean |
isSelected(java.lang.String fieldValue,
java.lang.String requestValue)
Returns true if the two parameters are equal. |
boolean |
isSubmitted()
Returns if the form has been submitted or not. |
static boolean |
isValidEmailAddress(java.lang.String theAddress)
Oversimplistic method to validate email addresses. |
protected java.lang.String |
removeHtmlTags(java.lang.String content)
Removes all HTML tags from the given String by using a regular expression. |
void |
setErrors(java.util.Map errors)
Sets the error Map holding the validation errors. |
abstract boolean |
validate()
Validates the values of the input fields and creates error messages, if necessary. |
| Methods inherited from class org.opencms.frontend.templateone.CmsTemplateBase |
|---|
getOriginalUri, initUri, isUriChanged |
| 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, 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 MESSAGE_BUNDLE_FORM
public static final java.lang.String PARAM_ACTION
| Constructor Detail |
|---|
public CmsTemplateForm()
public CmsTemplateForm(javax.servlet.jsp.PageContext context,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Use this constructor for the template.
context - the JSP page context objectreq - the JSP requestres - the JSP response| Method Detail |
|---|
public static java.lang.String getFormattedString(java.lang.String inputString,
char sepChar,
int lineLength,
java.lang.String separator)
inputString - the input String to modifysepChar - the separator character to look up in the input StringlineLength - the line length after which a break should occurseparator - the separator String to append as line breaks, e.g. <br>
public static boolean isValidEmailAddress(java.lang.String theAddress)
theAddress - the email address to validate
public java.lang.String getConfigPath()
Overwrites the method in the super class because the uri is set to the form uri in the module.
getConfigPath in class CmsTemplateBeanpublic java.lang.String getError(java.lang.String key)
key - error key to look up
public java.util.Map getErrors()
public java.lang.String getFormText(java.lang.String element,
boolean stripHtml)
element - the name of the element to displaystripHtml - indicates if HTML tags should be filtered from the element contents
public java.lang.String getFormUri()
This can be used for the "action" attribute value of the <form> tag.
public java.lang.String getPageTitle()
If the title property is not found, the page URI is returned instead.
public java.lang.String getPageUri()
Includes all request parameters of the page, too.
public java.lang.String getPageUri(boolean removeParams)
Removes all request parameters from the page URI, if specified.
removeParams - if true, all request parameters will be removed from the URI
public java.lang.String getPageUrl()
public java.lang.String getTextsUri()
public boolean hasValidationErrors()
public void init(javax.servlet.jsp.PageContext context,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
It is required to call one of the init() methods before you can use the instance of this bean.
init in class CmsTemplateBeancontext - the JSP page context objectreq - the JSP requestres - the JSP responsepublic java.lang.String isChecked(java.lang.String fieldValue)
fieldValue - the value of the field to test
public boolean isSelected(java.lang.String fieldValue,
java.lang.String requestValue)
Use this method to determine which entry of a select box or radio buttons is selected.
fieldValue - the current option or radio button value to checkrequestValue - the current request value
public boolean isSubmitted()
Checks the presence of the "action" request parameter.
public void setErrors(java.util.Map errors)
errors - error Mappublic abstract boolean validate()
protected abstract java.lang.String checkTextsUri()
Returns the default texts URI if the file specified in the configuration can not be found.
protected java.lang.String removeHtmlTags(java.lang.String content)
content - the String to scan for HTML tags
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||