Esempio n. 1
0
  /**
   * Render both dynamic and static JavaScript to perform validations based on the supplied form
   * name.
   *
   * @param formName the key (form name)
   * @param getStatic indicates if the static methods should be rendered
   * @return the Javascript for the specified form
   * @throws Exception
   */
  protected String getJavascript(String formName, boolean getStatic) throws Exception {
    StringBuffer results = new StringBuffer();

    Locale locale = StrutsUtils.getLocale(request, session);

    Form form = resources.getForm(locale, formName);
    if (form != null) {
      results.append(getDynamicJavascript(resources, locale, form));
    }

    if (getStatic) {
      results.append(getJavascriptStaticMethods(resources));
    }

    if (form != null) {
      results.append(getJavascriptEnd());
    }

    return results.toString();
  }