Class FormGroup

  • All Implemented Interfaces:
    Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag

    public class FormGroup
    extends javax.servlet.jsp.tagext.BodyTagSupport
    An <appNG:formGroup> can contain multiple <appNG:formElement>s. The elements of a group are implicitly enclosed with a <div> container whose style attribute can be set using the styleClass attribute of the taglet.

    Attributes:
    All of the following attributes are optional.

    • name - the name of the input element(s) this group refers to
    • mandatory - set to true if the field is mandatory
    • mandatoryMessage - the message to be displayed when no value has been entered for a mandatory field
    • errorMessage - the error message to be displayed when validation fails
    • errorClass - the CSS class to add to enclosing <div> and the element(s) with the given name when validation fails
    • errorElementId - the id of a nested element to append a <span> with the error message
    • styleClass -a CSS class for the enclosing <div>
    Usage:
     Favorite number:<br/>
     <appNG:formGroup name="select" styleClass="group" mandatory="true" mandatoryMessage="Please make your selection!" errorClass="error" errorElementId="numberError">
       <select name="select">
         <appNG:formElement>
           <option value="42">42</option>
         </appNG:formElement>
         <appNG:formElement>
           <option value="0815">0815</option>
         </appNG:formElement>
         <appNG:formElement>
           <option value="1701">1701</option>
         </appNG:formElement>
       </select>
     </appNG:formGroup>
     <div id="numberError"></div>
     
    Output (before submitting):
     Favorite number:<br/>
     <div class="group">
       <select name="select">
         <option value="42">42</option>
         <option value="0815">0815</option>
         <option value="1701">1701</option>
       </select>
       <div id="numberError"></div>
     </div>
     
    Output (after submitting, nothing selected):
     Favorite number:<br/>
     <div class="group error">
       <select name="select" class="error">
         <option value="42">42</option>
         <option value="0815">0815</option>
         <option value="1701">1701</option>
       </select>
      <div id="numberError"><span>Please make your selection!</span></div>
     </div>
     
    Author:
    Matthias Müller
    See Also:
    FormElement, Form, Serialized Form
    • Constructor Detail

      • FormGroup

        public FormGroup()
    • Method Detail

      • doStartTag

        public int doStartTag()
                       throws javax.servlet.jsp.JspException
        Specified by:
        doStartTag in interface javax.servlet.jsp.tagext.Tag
        Overrides:
        doStartTag in class javax.servlet.jsp.tagext.BodyTagSupport
        Throws:
        javax.servlet.jsp.JspException
      • doAfterBody

        public int doAfterBody()
                        throws javax.servlet.jsp.JspException
        Specified by:
        doAfterBody in interface javax.servlet.jsp.tagext.IterationTag
        Overrides:
        doAfterBody in class javax.servlet.jsp.tagext.BodyTagSupport
        Throws:
        javax.servlet.jsp.JspException
      • release

        public void release()
        Specified by:
        release in interface javax.servlet.jsp.tagext.Tag
        Overrides:
        release in class javax.servlet.jsp.tagext.BodyTagSupport
      • getWrappedFormGroup

        protected FormGroup getWrappedFormGroup()
      • getFormData

        public FormData getFormData()
      • getErrorClass

        public String getErrorClass()
      • setErrorClass

        public void setErrorClass​(String errorClass)
      • getStyleClass

        public String getStyleClass()
      • setStyleClass

        public void setStyleClass​(String styleClass)
      • getName

        public String getName()
      • setName

        public void setName​(String name)
      • isMandatory

        public boolean isMandatory()
      • setMandatory

        public void setMandatory​(boolean mandatory)
      • isMultiple

        public boolean isMultiple()
      • setMultiple

        public void setMultiple​(boolean multiple)
      • getMandatoryMessage

        public String getMandatoryMessage()
      • setMandatoryMessage

        public void setMandatoryMessage​(String mandatoryMessage)
      • getErrorElementId

        public String getErrorElementId()
      • setErrorElementId

        public void setErrorElementId​(String errorElementId)
      • getErrorMessage

        public String getErrorMessage()
      • setErrorMessage

        public void setErrorMessage​(String errorMessage)