Class File


public class File extends UIBean
Renders an HTML file input element.

Examples

 
 <s:file name="anUploadFile" accept="text/*" />
 <s:file name="anohterUploadFIle" accept="text/html,text/plain" />
 
 
  • Field Details

  • Constructor Details

    • File

      public File(ValueStack stack, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
  • Method Details

    • getDefaultTemplate

      protected String getDefaultTemplate()
      Description copied from class: UIBean
      A contract that requires each concrete UI Tag to specify which template should be used as a default. For example, the CheckboxTab might return "checkbox.vm" while the RadioTag might return "radio.vm". This value not begin with a '/' unless you intend to make the path absolute rather than relative to the current theme.
      Specified by:
      getDefaultTemplate in class UIBean
      Returns:
      The name of the template to be used as the default.
    • getControlType

      protected HtmlControlType getControlType()
      Description copied from class: UIBean
      The kind of HTML control this component renders, used to decide which HTML5 constraint attributes are legal on it. Defaults to HtmlControlType.UNSUPPORTED, which supports no constraints — so a component that does not override this emits none.
      Overrides:
      getControlType in class UIBean
    • getValueClassType

      protected Class<?> getValueClassType()
      A file input never renders its value, so keep the raw property: converting null to a String yields "", which would hide a missing attachment from the constraint derivation.
      Overrides:
      getValueClassType in class UIBean
    • applyValueParameter

      protected void applyValueParameter(String translatedName)
      Unlike the String conversion, the raw lookup honours struts.el.throwExceptionOnFailure. A file input is routinely bound to no property at all — an UploadedFilesAware action receives the part by name — so that one failure is not the misconfiguration the flag exists to surface.
      Overrides:
      applyValueParameter in class UIBean
      Parameters:
      translatedName - the already evaluated UIBean.name
    • evaluateParams

      public void evaluateParams()
      Overrides:
      evaluateParams in class UIBean
    • setAccept

      public void setAccept(String accept)
    • setSize

      public void setSize(String size)
    • setValue

      public void setValue(String value)
      Overrides:
      setValue in class UIBean