Class Output


@Marshalled(typeName="output") public class Output extends HtmlElementMixed<Output>
DTO for an HTML <output> element.

The output element represents the result of a calculation or user action. It is typically used to display the result of form calculations, such as the sum of two numbers or the result of a mathematical operation. The for attribute can be used to associate the output with specific form controls that contribute to the calculation.

Examples:

import static org.apache.juneau.bean.html5.HtmlBuilder.*; // Simple output element Output output1 = output("0") .name("result"); // Output with form association Output output2 = output("0") .name("sum") .for_("num1 num2"); // Output in a calculation form Form calcForm = form( input("number").name("num1").id("num1").value("0"), span(" + "), input("number").name("num2").id("num2").value("0"), span(" = "), output("0").name("sum").for_("num1 num2") ); // Output with styling Output output3 = output("Ready for calculation") .name("display") .class_("result-display");

The following convenience methods are provided for constructing instances of this bean:

See Also:
  • Constructor Details

  • Method Details

    • for_

      public Output for_(String value)
      for attribute.

      Specifies the IDs of form controls from which the output value was calculated. This creates a programmatic relationship between the output and its source controls.

      Multiple IDs can be specified as a space-separated list.

      Parameters:
      value - The IDs of the form controls that contribute to this output. Can be null to unset the attribute.
      Returns:
      This object.
    • form

      public Output form(String value)
      form attribute.

      Associates the output element with a form element by specifying the form's ID. This allows the output to be placed outside the form element while still being part of the form.

      The value should match the ID of a form element in the same document.

      Parameters:
      value - The ID of the form element to associate with this output. Can be null to unset the attribute.
      Returns:
      This object.
    • name

      public Output name(String value)
      name attribute.

      Specifies the name of the output element. This name is used when the form is submitted and can be used to access the element via the form.elements API.

      The name should be unique within the form and should not contain spaces or special characters.

      Parameters:
      value - The name of the output element for submission and API access. Can be null to unset the attribute.
      Returns:
      This object.