Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.

public final class Html

  1. Object
  2. Html
Primitives called by generated views; no template evaluation occurs here.

Methods

public static byte[] utf8(String text)
public static byte[] bytes(ByteSink out)
public static String string(Object value)
public static boolean truth(Object value)
public static boolean equal(Object a, Object b)
public static void text(ByteSink out, Object value)
public static void attribute(ByteSink out, String name, Object value)
public static String attributeValue(Object value)Snapshot an attribute’s textual value before it is checked and rendered.
public static String submitMethod(Model model, String value)A submitter can belong to a form outside this template or fragment.
public static String formEncoding(String value)Form binding supports the two structured HTML form encodings.
public static String htmxParameters(Model model, boolean urlParameters, String parameters)Preserve parameter filtering while keeping CSRF tokens out of htmx GET and DELETE URLs.
public static String htmxHeaders(Model model, boolean mutation, String headers)htmx headers work for standalone controls and methods that serialize fields in URLs.
public static void booleanAttribute(ByteSink out, String name, Object value)
public static String urlPart(Object value)
public static Object badModel(String message)
public static Object require(Model model, String name, String view)
public static Object field(Model model, String form, String name, Object fallback)
public static String errors(Model model, String form, String name)
public static String optionValue(Object value)The browser derives an option’s implicit value by collapsing ASCII whitespace.
public static boolean checked(Object value, Object candidate)
public static Model model(HttpServer.Request request)
public static void csrf(ByteSink out, Model model)
public static void csrf(ByteSink out, Model model, Object formId)
public static void safeUrl(String value)
public static void localLocation(String location)
public static HttpServer.Response redirect(HttpServer.Request request, String location)

Inherited methods

Method details

utf8

public static byte[] utf8(String text)

bytes

public static byte[] bytes(ByteSink out)

string

public static String string(Object value)

truth

public static boolean truth(Object value)

equal

public static boolean equal(Object a, Object b)

text

public static void text(ByteSink out, Object value)

attribute

public static void attribute(ByteSink out, String name, Object value)

attributeValue

public static String attributeValue(Object value)
Snapshot an attribute’s textual value before it is checked and rendered.

submitMethod

public static String submitMethod(Model model, String value)
A submitter can belong to a form outside this template or fragment.

formEncoding

public static String formEncoding(String value)
Form binding supports the two structured HTML form encodings.

htmxParameters

public static String htmxParameters(Model model, boolean urlParameters, String parameters)
Preserve parameter filtering while keeping CSRF tokens out of htmx GET and DELETE URLs.

htmxHeaders

public static String htmxHeaders(Model model, boolean mutation, String headers)
htmx headers work for standalone controls and methods that serialize fields in URLs.

booleanAttribute

public static void booleanAttribute(ByteSink out, String name, Object value)

urlPart

public static String urlPart(Object value)

badModel

public static Object badModel(String message)

require

public static Object require(Model model, String name, String view)

field

public static Object field(Model model, String form, String name, Object fallback)

errors

public static String errors(Model model, String form, String name)

optionValue

public static String optionValue(Object value)
The browser derives an option’s implicit value by collapsing ASCII whitespace.

checked

public static boolean checked(Object value, Object candidate)

model

public static Model model(HttpServer.Request request)

csrf

public static void csrf(ByteSink out, Model model)

csrf

public static void csrf(ByteSink out, Model model, Object formId)

safeUrl

public static void safeUrl(String value)

localLocation

public static void localLocation(String location)

redirect

public static HttpServer.Response redirect(HttpServer.Request request, String location)