コード例 #1
0
 /**
  * Override method runScript in class BaseJellyFormControlTag
  *
  * @see
  *     com.cyclopsgroup.waterview.jelly.taglib.BaseJellyControlTag#runScript(org.apache.commons.jelly.Script,
  *     org.apache.commons.jelly.XMLOutput)
  */
 protected void runScript(Script script, XMLOutput output) throws Exception {
   FormTag.setHideControls(true, getContext());
   String formContent = getBodyText();
   FormTag.setHideControls(false, getContext());
   if (formTag == null) {
     throw new JellyTagException("Form tag must be defined");
   }
   JellyContext jc = new JellyContext(getContext());
   jc.setVariable("formControl", this);
   jc.setVariable("formTag", formTag);
   jc.setVariable("form", formTag.getForm());
   jc.setVariable("formContent", formContent);
   script.run(jc, output);
 }
コード例 #2
0
  /**
   * Overwrite or implement method processTag()
   *
   * @see
   *     com.cyclopsgroup.waterview.utils.TagSupportBase#processTag(org.apache.commons.jelly.XMLOutput)
   */
  protected void processTag(XMLOutput output) throws Exception {
    requireAttribute("script");
    invokeBody(XMLOutput.createDummyXMLOutput());

    if (formTag == null) {
      throw new JellyTagException("Form tag must be defined");
    }
    JellyEngine je = (JellyEngine) getServiceManager().lookup(JellyEngine.ROLE);
    Script script = je.getScript(getScript());

    JellyContext jc = new JellyContext(getContext());
    jc.setVariable("formTag", formTag);
    jc.setVariable("form", formTag.getForm());

    script.run(jc, output);
  }