
The Use-API is an easy way to bind logic to template elements. Use-API objects can be written in Java, JavaScript or both: business logic belongs in Java, and view-specific logic can be written in server-side JavaScript.
Example: passing parameters from a component
<div data-sly-use.myClass="${'com.myproject.components.MyTestComponent' @ firstName='John', lastName='Miller'}">
${myClass.fullname}
</div>
import com.adobe.cq.sightly.WCMUsePojo;
public class MyTestComponent extends WCMUsePojo {
// Combine the firstName and lastName
public String getFullname() {
return get("firstName", String.class) + " " + get("lastName", String.class);
}
}

For new components, Sling Models are the recommended alternative to WCMUsePojo.