Switch JSP Tag Overview

The Switch JSP tag is a server-side wrapper for the Kendo UI Switch widget.

Getting Started

The Basics

Kendo UI Switch is used to display two exclusive choices.

Configuration

Below are listed the steps for you to follow when configuring the Kendo UI Switch in the Spring MVC framework.

Step 1 Make sure you followed all the steps from the introductory article on Telerik UI for JSP.

Step 2 Create a new action method.

Example
    @RequestMapping(value = { "/", "/index" }, method = RequestMethod.GET)
    public String index() {
        return "web/switch/index";
    }

Step 3 Add the Kendo UI taglib mapping to the page.

Example
    <%@taglib prefix="kendo" uri="http://www.kendoui.com/jsp/tags"%>

Step 4 Add a switch tag.

Example
<kendo:switchButton name="switch">
</kendo:switchButton>

Event Handling

Subscribe to Events

You can subscribe to all events exposed by Kendo UI Switch by the handler name.

Example
<kendo:switchButton name="switch" change="switchOnChange">
</kendo:switchButton>

<script>
function switchOnChange(e) {
    kendoConsole.log("Change :: checked: " + e.checked);
}
</script>

Reference

Existing Instances

You are able to reference an existing Switch instance via jQuery.data(). Once a reference is established, you are able to use the Switch API to control its behavior.

Example
// Put this after your Kendo Switch tag declaration
<script>
    $(function() {
        // Notice that the name attribute of the switch is used to get its client-side instance
        var switch = $("#switch").data("kendoSwitch");
    });
</script>

See Also

Other articles on Telerik UI for JSP and on the Switch:

In this article
Not finding the help you need? Improve this article