Example #1
0
  public void generate() throws IOException {
    Map<String, Object> params = context.getParameters();
    Attributes a = new Attributes();

    a.addDefaultToEmpty("name", params.get("name"))
        .add("type", "hidden")
        .addIfExists("value", params.get("nameValue"))
        .addIfTrue("disabled", params.get("disabled"))
        .addIfExists("id", params.get("id"))
        .addIfExists("class", params.get("cssClass"))
        .addIfExists("style", params.get("cssStyle"));
    super.start("input", a);
    super.end("input");
  }
  public void generate() throws IOException {
    Map<String, Object> params = context.getParameters();
    Attributes a = new Attributes();

    a.addDefaultToEmpty("name", params.get("name"))
        .addIfExists("for", params.get("for"))
        .addIfExists("id", params.get("id"))
        .addIfExists("class", params.get("cssClass"))
        .addIfExists("style", params.get("cssStyle"))
        .addIfExists("title", params.get("title"));
    super.start("label", a);
    String value = (String) params.get("nameValue");
    if (StringUtils.isNotEmpty(value)) characters(value);
    super.end("label");
  }
Example #3
0
  public void generate() throws IOException {
    Map<String, Object> params = context.getParameters();
    Attributes attr = new Attributes();

    attr.add("type", "text")
        .addDefaultToEmpty("name", params.get("name"))
        .addIfExists("size", params.get("size"))
        .addIfExists("maxlength", params.get("maxlength"))
        .addIfExists("value", params.get("nameValue"))
        .addIfTrue("disabled", params.get("disabled"))
        .addIfTrue("readonly", params.get("readonly"))
        .addIfExists("tabindex", params.get("tabindex"))
        .addIfExists("id", params.get("id"))
        .addIfExists("class", params.get("cssClass"))
        .addIfExists("style", params.get("cssStyle"))
        .addIfExists("title", params.get("title"));
    super.start("input", attr);
    super.end("input");
  }
 /* (non-Javadoc)
  * @see org.apache.struts2.views.java.simple.AbstractTagHandler#start(java.lang.String, org.apache.struts2.views.java.Attributes)
  */
 @Override
 public void start(String name, Attributes a) throws IOException {
   a.addIfExists("accesskey", context.getParameters().get("accesskey"));
   super.start(name, a);
 }